2010-10-04 304 views
0

我有一個視圖控制器一樣聯繫人在iPhone中。該代碼是這樣的,使用視圖控制器既作爲模式視圖控制器和作爲標籤欄視圖控制器

tabBarController = [[UITabBarController alloc] init]; 
friendsVC = [[RemittanceFriendsVC alloc] initWithNibName:@"RemittanceFriendsView" bundle:nil]; 
friendsVC.friendsArray = [[RemittanceModel getInstance] friends]; 
UINavigationController *friendsNVC = [[UINavigationController alloc] initWithRootViewController: friendsVC]; 
[controllers addObject:friendsNVC]; 
tabBarController.viewControllers = controllers; 

的RemittanceFriendsVC是的UITableViewController,點擊一個單元中,在細節查看。我在ViewController(VC)中設置了'modal'變量來知道它是否加載爲模態。由於它是標籤欄項目的一部分,(非模態視圖)它工作正常。但是當我將它作爲模態VC加載時,當我單擊一個表格單元格時,我想要解除模態視圖,但它並未忽略模態視圖。

在friendVC這是行不通的,

-(void) didPressCancelButton { 
     [self.navigationController dismissModalViewControllerAnimated:YES]; 
} 

我想要做的是,使用相同的VC的標籤欄項目,有時爲模式的VC。這不可能嗎?

回答

0

沒關係,這是與

[self.navigationController dismissModalViewControllerAnimated:YES]; 

的問題應該是,

[self dismissModalViewControllerAnimated:YES]; 

然後正常工作。

相關問題