gpt4 book ai didi

iphone - dismissModalViewControllerAnimated 不返回

转载 作者:行者123 更新时间:2023-11-29 11:17:13 24 4
gpt4 key购买 nike

如果我将一个 View 推送到 Navcontroller 上,它工作得很好,我可以使用代码或使用 Nav Controller 后退按钮从它返回。

然后我将其更改为以模态方式呈现 View 。预设有效,但我无法让它返回并关闭模态视图。

这有效……主视图

   Tools *screen = [[Tools alloc] initWithNibName:@"Tools" bundle:[NSBundle mainBundle]];

[mainNavController pushViewController:screen animated:YES];

[screen release];

模态视图之一:

- (IBAction)btnCancel:(id)sender {


[self.navigationController popToViewController:[self.navigationController.viewControllers objectAtIndex:0] animated:YES];


}

但是后来我在模态视图上将它更改为这样的模态,它不会返回到主视图。

Tools *screen = [[Tools alloc] initWithNibName:@"Tools" bundle:[NSBundle mainBundle]];

[mainNavController presentModalViewController:screen animated:YES];

[screen release];

在模态视图上:

- (IBAction)btnCancel:(id)sender {


[self.parentViewController dismissModalViewControllerAnimated:YES];


}

我已经尝试了所有我能想到的,显然我错过了一些东西!有什么想法吗?

感谢您的帮助!!

最佳答案

dismiss the modal view from self (模态视图)

[self dismissModalViewControllerAnimated:YES];

关于iphone - dismissModalViewControllerAnimated 不返回,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8919399/

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