1

ストーリーボードを使用するプロジェクトが 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ますか? 助けてくれてありがとう。

4

1 に答える 1

2

私があなたを正しく理解していて、最初のテーブルのセルが選択されたときに新しいテーブルビューコントローラーをプッシュしたいだけなら、不足しているのは必要なものだけです

[self performSegueWithIdentifier:@"Records"]; 

あなたのtableView didSelectRowAtIndexPathメソッドで。

于 2012-05-09T18:34:53.150 に答える