2014-02-25 164 views

回答

0

按下後,調用setViewControllers:animated:,將中間視圖控制器插入堆棧。

+0

http://www.apeth.com/iOSBook/ch19.html#_configuring_a_navigation_controller – matt

+0

setviewcontrollers:如果我沒有錯,動畫方法會在iOS 7中崩潰.. –

+0

你錯了。當然,如果你把它稱爲錯誤的話,你可能會崩潰。 https://developer.apple.com/library/ios/Documentation/UIKit/Reference/UINavigationController_Class/Reference/Reference.html#jumpTo_21 – matt

0

還有很多其他的方式做,但我更喜歡這一個:

的,你必須以編程方式添加導航欄按鈕爲「回」的第一個視圖控制器(你的情況),但在這種情況下,你需要back_arrow image:

UIImage *faceImage = [UIImage imageNamed:@"back_arrow.png"]; 
UIButton *face = [UIButton buttonWithType:UIButtonTypeCustom]; 
face.bounds = CGRectMake(10, 0, faceImage.size.width, faceImage.size.height); 
[face addTarget:self action:@selector(handleBack) forControlEvents:UIControlEventTouchUpInside]; 
[face setImage:faceImage forState:UIControlStateNormal]; 
UIBarButtonItem *backButton = [[UIBarButtonItem alloc] initWithCustomView:face]; 
self.navigationItem.leftBarButtonItem = backButton; 
[self.navigationItem setHidesBackButton:YES animated:YES]; 
[self.navigationItem setLeftBarButtonItem:nil animated:NO]; 
[self.navigationItem setBackBarButtonItem:nil]; 

-(void)handleBack 
{ 
    //got third view controller here 
} 

可能會幫助你。

相關問題