2016-11-05 9 views
-1

저는 Objective C에서 매우 새로워졌으며 현재 프로젝트를 진행 중입니다. Tableview의 각 셀에 대한 컨트롤러보기

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

지금 나는의 ViewController 각 셀에서 푸시 Seque을 얻으려고하지만, 이것이 어떻게 작동하는지 난 정말 생각을하지 않았습니다.

여기

- (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. 식별자 대상 뷰 컨트롤러로 현재 뷰 컨트롤러에서 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. 위의 예에서 집

    3. 에 소개에서 홈
    4. 에 설정에서 홈
    5. 에 프로필에서 홈 화면

      1. 에가는 세 가지 가능성이 있습니다

      그래서 당신은 3을 작성해야 segue의 동일한 식별자와 함께 그 화면에서 가정으로 이어집니다. 위의 예에서는 12 개의 단락이 있습니다.

  • 관련 문제