2017-06-27 8 views
0

ストーリーボードを使用してシングルビューアプリケーションを作成しました。 は私がストーリーボードファイルでviewcontoller.mファイルプロトタイプのセルが次のビューコントローラーに移動しませんストーリーボード

#import "ViewController.h" 

@interface ViewController() 

@end 

@implementation ViewController 
{ 
    NSArray *recipes; 
} 
- (void)viewDidLoad { 
    [super viewDidLoad]; 
    // Do any additional setup after loading the view, typically from a nib. 
    recipes = [NSArray arrayWithObjects:@"Egg Benedict", @"Mushroom Risotto", @"Full Breakfast", @"Hamburger", @"Ham and Egg Sandwich", @"Creme Brelee", @"White Chocolate Donut", @"Starbucks Coffee", @"Vegetable Curry", @"Instant Noodle with Egg", @"Noodle with BBQ Pork", @"Japanese Noodle with Pork", @"Green Tea", @"Thai Shrimp Cake", @"Angry Birds Cake", @"Ham and Cheese Panini", nil]; 
} 
-(NSInteger)tableView :(UITableView *)tableView numberOfRowsInSection :(NSInteger)section 
{ 
    return [recipes count]; 

} 
-(UITableViewCell *) tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath 
{ 
    static NSString *[email protected]"RecpieCell"; 
    UITableViewCell *cell =[tableView dequeueReusableCellWithIdentifier:simpleTableIdentifier]; 
    if(cell ==nil) 
    { 
     cell=[[UITableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:simpleTableIdentifier]; 
    } 

    cell.textLabel.text=[recipes objectAtIndex:indexPath.row]; 
    return cell; 

} 

@end 

を持って

#import <UIKit/UIKit.h> 

@interface ViewController : UIViewController<UITableViewDelegate, UITableViewDataSource> 


@end 

viewcontoller.hファイルを持って、私は3つのビューコントローラ

1-ナビゲーションコントローラ2-レシピブックを持っていますコントローラを表示3 - 表示 コントローラ

レシピブックビューコントローラのテーブルビューのプロトタイプセルが、プッシュセグを使用してViewコントローラに接続されています。レシピブックビューコントローラがView Controllerにナビゲートしないという問題がありますか?

enter image description here

enter image description here

enter image description here

enter image description here

+0

スクリーンショットでは、テーブルビュー行のアクションは表示されません。 「Table View Cell」を選択すると、セグがインスペクタの「アクション」にリンクされます。これは本当ですか? – Paulw11

+0

をクリックするとViewcontrollerに移動しますか? –

+0

はい...このリンクから、修正のサンプルをダウンロードできます。https://www.dropbox.com/s/kpybdmtov7i0wne/RecipeBook.zip?dl=0 –

答えて

-1

ただ、マニュアルセグエを行います。あなたはそれをする方法を知っていますか? Ctrlキーを押しながら別のビューコントローラーにドラッグします。それに識別子を付けます。

次に、関数 "didSelectRowAt indexPath"をオーバーライドします。ここでperformSegueを呼び出します。

関連する問題