2016-11-05 10 views
-1

私はObjective Cの新機能で、現在はプロジェクトに取り組んでいます。Tableviewの各セルのコントローラを表示

I've created a Slide-Out-Menu, which is based on my own Database

今私はプッシュSeque、各セルからのViewControllerのを取得しようとしているが、私は実際にこれがどのように機能するかのアイデアを持っていません。

はここ

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { 
return 1; } 

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { 
NSArray *numarray = [self getServerConnection]; 
for (NSDictionary *diction in numarray) { 
    NSDictionary *menuID = [diction objectForKey:@"id"]; 
    NSString *num = [NSString stringWithFormat:@"%@",menuID]; 
    intnum = [num intValue]; 
} 
return intnum; } 


- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { 

static NSString *CellIdentifier = @"Cell"; 
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; 

NSArray *namearray = [self getServerConnection]; 
for (NSDictionary *diction in namearray) { 
    name = [result valueForKey:@"name"]; 
    identifier = [menuArray valueForKey:@"identifier"]; 

    cell.textLabel.text = name [indexPath.row]; 

} 

return cell; } 
+1

あなたの問題の説明、わからないコード、ビデオへのリンク以外のものを私たちに提供してください。 – DominicanCoder

答えて

1

では、次のデータでサイドメニューに割り当てられた4個の細胞があると私のコードです。会社について

  • を設定

    1. ホーム
    2. プロフィール
    3. は、これらの画面のそれぞれには、識別子と、宛先ビューコントローラへの現在のビューコントローラからseguesを持っています。

      は、UITableViewクラスのデリゲートメソッドを使用します。

      -(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{ 
          if (indexPath.row == 0){ 
           [self performSegueWithIdentifier:@"ProfileScreenSegueIdentifier" sender:self]; 
          }else if(indexPath.row == 1){ 
           [self performSegueWithIdentifier:@"HomeScreenSegueIdentifier" sender:self]; 
          }// So one... 
      } 
      

      注:プッシュを作成してください...あなたのスクリーンのそれぞれの間 例をsegues。上記の例で ホーム

    4. にお問い合わせからホーム
    5. に設定からホーム
    6. にプロファイルからホーム画面

      1. に行くの3つの可能性があります

      だから、3を作成する必要がありますこれらの画面から、同じアイデンティティのアイデンティティを持つ家庭につなぎます。 上記の例では12個のセグがあります。

  • 関連する問題