我有 A -> B ->C Controller ,与下一个委托(delegate)链接:
@protocol ViewControllerDelegate <NSObject>
- (void)onResult:(ControllerDelegateObject *)delegateObject;
@end
在 C 中我调用:
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
ControllerDelegateObject *object = [[ControllerDelegateObject alloc]init];
object.model = indexPath.row;
[delegate onResult:object];
[ self.navigationController popViewControllerAnimated:YES ];
}
比我在 B 得到的:
-(void)onResult:(ControllerDelegateObject *)delegateObject{
delegateObject.brand = self.chosenBrand;
[delegate onResult:delegateObject];
[ self.navigationController popViewControllerAnimated:YES ]; **//doesn't work**
NSLog(@"TEST2");
}
为什么在委托(delegate)回调中没有第二次调用 [ self.navigationController popViewControllerAnimated:YES ]?
最佳答案
如果你想去A:
popToRootViewControllerAnimated:
如果你有超过 3 个 View Controller A->B->C->D 并且你想从 D 转到 B,则另一种选择。
- popToViewController:animated:
关于ios - [ self.navigationController popViewControllerAnimated :YES ]; doesn't work in delegate callback,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13551468/