的按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