gpt4 book ai didi

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

转载 作者:塔克拉玛干 更新时间:2023-11-02 21:47:05 25 4
gpt4 key购买 nike

我有 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:

引用UINavigationController Class Reference

关于ios - [ self.navigationController popViewControllerAnimated :YES ]; doesn't work in delegate callback,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13551468/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com