繁体   English   中英

[self.navigationController popViewControllerAnimated:YES]; 在委托回调中不起作用

[英][ self.navigationController popViewControllerAnimated:YES ]; doesn't work in delegate callback

我有A-> B-> C控制器,与下一个委托链接:

@protocol ViewControllerDelegate <NSObject>

- (void)onResult:(ControllerDelegateObject *)delegateObject;

@end

并在CI中致电:

- (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");
}

为什么[self.navigationController popViewControllerAnimated:YES]在委托回调中没有第二次被调用?

如果要转到A:

popToRootViewControllerAnimated:

如果您有3个以上的视图控制器A-> B-> C-> D,并且想要从D转到B,则可以选择另一种选择。

- popToViewController:animated:

请参阅UINavigationController类参考

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM