iPad viewWillAppear 和presentModalViewController 问题

发布于 2024-08-23 04:13:23 字数 444 浏览 10 评论 0原文

在iPhone中,我有一个表格视图,触摸单元格,我有一个方法调用presentModalViewController,并打开另一个视图,其中包含电子邮件和此类内容。 当用户按下取消按钮时,将调用上一个视图中的 viewWillAppear 方法。 到目前为止,一切都很好。但在iPad中,viewWillAppear仅在视图第一次出现时被调用,有人知道这是一个错误还是正确的? 我尝试实施

- (void)navigationController:(UINavigationController *)navigationController didShowViewController:(UIViewController *)viewController animated:(BOOL)animated{

但没有成功。

有谁知道如何解决这个问题而不需要从头开始执行任何委托方法? 提前致谢

In the iPhone, I have a tableview, and touching the cells, I have one method calling presentModalViewController, and opening another view, with email and this kind of stuff.
When the user press the cancel button, the viewWillAppear method in the previous view is called.
So far, so good. But in the iPad, the viewWillAppear is only called the first time that the view appears, anyone knows if this is a bug or it's right?
I tried to implement the

- (void)navigationController:(UINavigationController *)navigationController didShowViewController:(UIViewController *)viewController animated:(BOOL)animated{

with no success.

Does anybody know how to fix this without doing any delegate method from scratch?
Thanks in advance

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

清引 2024-08-30 04:13:24

由于以模态方式呈现的视图控制器不一定完全覆盖 iPad 上的底层视图,因此当所述模态视图控制器被关闭时, viewWillAppear 方法不会触发。我依靠委托方法向原始视图控制器宣布模态视图控制器的操作。我认为这是最好的方法。

Since view controllers presented modally don't necessarily completely cover up the underlying view on iPad, the viewWillAppear method does not fire when said modal view controllers get dismissed. I rely on delegate methods to announce to the original view controller the actions of the modal view controller. I think it's the best way to go.

本王不退位尔等都是臣 2024-08-30 04:13:24

基于猜测,而不是阅读、测试或任何真正有用的东西,但因此未涵盖在 NDA 中...

当您呈现 ModalViewController 时是否调用 viewWillDisappear ?可能它不认为模态视图完全遮挡原始视图,因此(与 iPhone 不同)两者同时存在?

Based on guesswork, rather than reading, testing or anything useful really, but therefore not covered under the NDA...

Is viewWillDisappear being called when you presentModalViewController ? It may be that it doesn't think the modal view obscures the original view fully, therefore (unlike the iPhone) both exist at once ?

假扮的天使 2024-08-30 04:13:24

很可能这是一个错误,我会在此处向苹果提交错误报告。

Chances are it's a bug, I would file a bug report with apple here.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文