简体   繁体   English

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

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

I have A -> B - >C controllers, linked with the next delegate: 我有A-> B-> C控制器,与下一个委托链接:

@protocol ViewControllerDelegate <NSObject>

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

@end

and in CI call: 并在CI中致电:

- (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: 比我进去的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? 为什么[self.navigationController popViewControllerAnimated:YES]在委托回调中没有第二次被调用?

If you want to go to A: 如果要转到A:

popToRootViewControllerAnimated:

Or another choice if you have more than 3 view controller A->B->C->D and you want to go from D to B. 如果您有3个以上的视图控制器A-> B-> C-> D,并且想要从D转到B,则可以选择另一种选择。

- popToViewController:animated:

Refer to UINavigationController Class Reference 请参阅UINavigationController类参考

暂无
暂无

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

相关问题 self.navigationcontroller popviewcontrolleranimated是,终止我的应用 - self.navigationcontroller popviewcontrolleranimated yes, terminates my app self.navigationController?来自UIAlertController的.popViewControllerAnimated - self.navigationController?.popViewControllerAnimated from UIAlertController popViewControllerAnimated:YES不起作用 - popViewControllerAnimated:YES doesn't work 为什么不&#39;self.navigationController?.pushViewController(mainPage,animated:true)&#39;工作? - Why doesn’t 'self.navigationController?.pushViewController(mainPage, animated: true)' work? 为什么self.navigationController pushViewController不起作用? - Why won't self.navigationController pushViewController work? 在调用popToRootViewControllerAnimated:YES后在self.navigationController中取消分配或删除ViewControllers - dealloc or remove ViewControllers in self.navigationController after popToRootViewControllerAnimated:YES is called [self.navigationController pushViewController:ngView animated:YES]; 不工作 - [self.navigationController pushViewController:ngView animated:YES]; not working 在[self.navigationController popToRootViewControllerAnimated:YES]期间分配变量; - Assigning a variable during [self.navigationController popToRootViewControllerAnimated:YES]; iOS-[self.navigationController setToolbarHidden:YES动画:NO]崩溃 - iOS - Crash on [self.navigationController setToolbarHidden:YES animated:NO] Deallocated error self.navigationController ==无 - self.navigationController == nil
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM