2012-11-28 33 views

回答

0

我想通了。 萬一別人運行到這個問題,這裏的解決方案..

務必將主控制器上添加所有的.h文件 對我來說,他們將

#import "tabbar26.h" 

現在這裏是代碼我添加到使其工作

- (UITableViewCell *)tableView:(UITableView *)tableView 
    cellForRowAtIndexPath:(NSIndexPath *)indexPath 
{ 
UITableViewCell *cell = [super tableView:tableView 
        cellForRowAtIndexPath:indexPath]; 
cell.accessoryType = UITableViewCellAccessoryNone; 

NSUInteger row = [indexPath row]; 


      if (row == 1) 
     { 
      NSLog(@"hi"); 

     } 

     if (row == 27) 
     { 
     } 
} 

return cell; 
} 

這部分上面,真的不需要。我只是用它來記錄。

下面是你需要真正:)

-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath  { 

NSUInteger row = [indexPath row]; 

if (row == 0) 
{ 
    NSLog(@"hi2"); 
    } 

if (row == 25) 
{ 
    NSLog(@"bye2"); 
    UIStoryboard *tabbar26 = [UIStoryboard storyboardWithName:@"tabbar26" bundle:nil]; 
     UIViewController *Tab1_ViewController = [tabbar26 instantiateInitialViewController]; 
    [self.navigationController pushViewController:Tab1_ViewController animated:(YES)]; 
} 

[self.tableView reloadData]; 
}