我有兩個不同的推送在視圖控制器如下進行:完成處於意外狀態的導航轉換。導航欄子視圖樹可能會損壞
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
indexPathRow = indexPath.row;
NSLog(@"indexPathRow.%d", indexPathRow);
safetyInventoryList.recordIdToEdit = [DeviceIdArray objectAtIndex:indexPathRow] intValue];
NSLog(@"Item selected..%d", inventoryList.recordIdToEdit);
[self performSegueWithIdentifier:@"DetailsViewController" sender:nil];
}
-(IBAction)ViewScoreBtn:(id)sender {
[self performSegueWithIdentifier:@"ScoreViewController" sender:nil];
}
我收到以下錯誤,黑屏,當我進入「viewscore」按鈕後,單擊後退按鈕 - > VC 。
nested push animation can result in corrupted navigation bar
Finishing up a navigation transition in an unexpected state. Navigation Bar subview tree might get corrupted.
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Can't add self as subview'
更新後的代碼:在賽格瑞我有以下(在我提出VC):(M)
if([segue.identifier isEqualToString:@"ScoreViewController"]){
ScoreViewController *destViewController = segue.destinationViewController;
destViewController.delegate = self;
}
和
- (void)dismissScoreViewController:MVVMScoreViewController{
[self dismissViewControllerAnimated:YES completion: nil];
}
在我提出的VC
準備(.H &.m):
@protocol dismissScoreDelegate <NSObject>
- (void)dismissScoreViewController:SafetyDeviceViewController;
@end
@property (nonatomic, assign) id<dismissScoreDelegate> delegate;
-(void) viewWillDisappear:(BOOL)animated {
if ([self.navigationController.viewControllers indexOfObject:self]==NSNotFound) {
// Navigation button was pressed. Do some stuff
[self.delegate dismissScoreViewController];
}
[super viewWillDisappear:animated];
}
那麼,哪裏出了問題?
可能重複[駁回呈現的視圖控制器(http://stackoverflow.com/questions/14636891/dismissing-a-presented-view-controller ) – Spectravideo328 2014-11-23 06:21:57
對不起,我是iOS新手,並沒有完全掌握它。 – Smitha 2014-11-23 06:31:25
我建議您閱讀View控制器上的Apple文檔:https://developer.apple.com/library/ios/documentation/WindowsViews/Conceptual/ViewControllerCatalog – Spectravideo328 2014-11-23 06:45:45