ストーリーボードを使用するプロジェクトが 1 つあります。私は1つ持っておりUIView
、いくつかの画像とボタンをビューに配置し、下部にもUITableView
. このコードを に入れましたUIView.h
。
interface MenuViewController : UIViewController<UITableViewDelegate, UITableViewDataSource>
{
IBOutlet UITableView *MenuTable;
NSMutableArray *TabloMenu;
id menuler;
}
@property (nonatomic, retain) IBOutlet UITableView *MenuTable;
@property (nonatomic, retain) NSMutableArray *TabloMenu;
そしてでiuview.m
:
- (NSInteger)numberOfSectionsInTableView:(UITableView *)table {
return 1;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
return [TabloMenu count];
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
static NSString *CellIdentifier = @"CellFirmalar";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
menuler = [TabloMenu objectAtIndex:[indexPath row]];
cell.textLabel.text = [menuler objectForKey:@"Tanim"];
}
return cell;
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
NSString *alertString = [NSString stringWithFormat:@"Clicked on row #%d", [indexPath row]];
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:alertString message:@"" delegate:self cancelButtonTitle:@"Done" otherButtonTitles:nil];
[alert show];
}
ここまではすべてうまくいっています。セルの行番号をクリックすると、データが表示されます。ストーリーボードに新規追加し、セグエ用にUITableViewController
テーブルビューをリンクしましたUITableViewController
-(void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender{
if([[segue identifier] isEqualToString:@"Records"]){
ResultTableViewController *cvc = (ResultTableViewController *)[segue destinationViewController];
}
}
しかし、これは切り替えていません。どうすればこれを切り替えることができUITableViewController
ますか? 助けてくれてありがとう。