2

我有 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 ]?

4

1 回答 1

1

如果你想去A:

popToRootViewControllerAnimated:

或者,如果您有超过 3 个视图控制器 A->B->C->D 并且您想从 D 转到 B,则另一种选择。

- popToViewController:animated:

请参阅UINavigationController 类参考

于 2012-11-25T13:39:30.803 回答