的按I制成的按钮,它连接到在界面生成器的动作。在操作方法中,从显示视图切换到显示表视图需要做什么?切换到的UITableView上的按钮
下面是我的一些代码:
// SwitchToTableViewController.h
#import <UIKit/UIKit.h>
@interface SwitchToTableViewController : UIViewController {
}
-(IBAction) switch : (id) sender;
@end
和
//SwitchToTableViewController.m
#import "SwitchToTableViewController.h"
#import "Table.h"
@implementation SwitchToTableViewController
-(IBAction) switch : (id) sender{
// what is i need to write here to switch to tableview
}
@end
和
//table.m
#import <UIKit/UIKit.h>
@interface Table : UITableViewController {
}
@end
和
//table.h
#import "Table.h"
@implementation Table
#pragma mark Table view methods
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
return 1;
}
// Customize the number of rows in the table view.
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
return 2;
}
// Customize the appearance of table view cells.
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
}
// Set up the cell...
return cell;
}
@end
你在这里有大量的代码是完全不相关的。它使人们无需阅读这个问题 - 不需要在项目中包含每行代码。 – jrturton 2012-07-08 11:58:26