I have A -> B – >C controllers, linked with the next delegate:
@protocol ViewControllerDelegate <NSObject>
- (void)onResult:(ControllerDelegateObject *)delegateObject;
@end
and in C I call:
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
ControllerDelegateObject *object = [[ControllerDelegateObject alloc]init];
object.model = indexPath.row;
[delegate onResult:object];
[ self.navigationController popViewControllerAnimated:YES ];
}
than I get in B:
-(void)onResult:(ControllerDelegateObject *)delegateObject{
delegateObject.brand = self.chosenBrand;
[delegate onResult:delegateObject];
[ self.navigationController popViewControllerAnimated:YES ]; **//doesn't work**
NSLog(@"TEST2");
}
why [ self.navigationController popViewControllerAnimated:YES ] is not called second time in the delegate callback?
If you want to go to A:
Or another choice if you have more than 3 view controller A->B->C->D and you want to go from D to B.
Refer to UINavigationController Class Reference