2010-06-29 111 views
1

我推動了一堆視圖到我的導航控制器,但在一些導航選擇我不想將它們添加到長列表,但我希望它顯示在在堆棧的前面,並擺脫其餘的。將視圖控制器推到ipad上的導航控制器堆棧前

這裏是我使用的行爲。

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { 
    NavigationTestAppDelegate *appDelegate = (NavigationTestAppDelegate *) [[UIApplication sharedApplication] delegate]; 

    UIViewController *targetController = nil; 

    switch (indexPath.row) { 
     case 0: 
      targetController = [[ClientListViewController alloc] init]; 
      targetController.title = @"Clients"; 
      break; 
     case 1: 

      break; 
     case 2: 
      targetController = [[MyInfoViewController alloc] init]; 
      targetController.title = @"My Information"; 
      break; 
     default: 
      break; 
    } 

    if ([targetController isKindOfClass:[ClientListViewController class]]) 
    { 
     [[self navigationController] pushViewController:targetController animated:YES]; 
    } else {  
    if (targetController) 
     [[appDelegate.homeViewController navigationController] pushViewController:targetController animated:YES]; 

    if (appDelegate.popoverController) 
     [appDelegate.popoverController dismissPopoverAnimated:YES]; 
    } 

    [targetController release]; 
} 

如果我的用戶點擊我想這是在導航控制器堆棧中的唯一的事情,有它在滑動MyInfoViewController

回答

相關問題