I have two different push perform in view controller as below:
- (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];
}
I get the following error and black screen when i click back button after entering "viewscore" button -> 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'
Updated code:in prepare for segue I have following (in my presenting VC):(.m)
if([segue.identifier isEqualToString:@"ScoreViewController"]){
ScoreViewController *destViewController = segue.destinationViewController;
destViewController.delegate = self;
}
and
- (void)dismissScoreViewController:MVVMScoreViewController{
[self dismissViewControllerAnimated:YES completion: nil];
}
in my presented 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];
}
So what's going wrong?