旋转视图时模式对话框出现问题

发布于 2024-10-11 22:29:32 字数 978 浏览 7 评论 0原文

我有一个可以旋转的子视图(不是根视图,让它成为视图 A)。我还有一个模态视图(让它成为视图 M),然后显示来自服务器的数据。我们的 QA 发现,如果数据在视图 A 旋转时出现,则模态视图 M 将不会显示。事实上,显示模态视图的代码将被执行,应用程序将转到根视图,但用户将看不到模态视图。

模态视图 M 用以下代码显示:

[self.navigationController popToViewController:self.rootViewController animated:animated];    
[self performSelector:@selector(showModalAcceptDialog:) withObject:requestID afterDelay:0.1];  

(void)showModalAcceptDialog:(NSManagedObjectID*)requestID {
    RequestAcceptViewController *requestAcceptViewController = [[RequestAcceptViewController alloc] initWithNibName:@"RequestAcceptViewController" bundle:nil];
    requestAcceptViewController.requestID = requestID;
    [[self navigationController] presentModalViewController:requestAcceptViewController animated:YES];
    [requestAcceptViewController release];  
}

在显示模态视图之前需要延迟来执行到根视图的导航。否则,应用程序将因某些内部异常而崩溃。

另外,横向模式下的视图 A 没有导航栏,并在消失时恢复它(在 viewWillDisappear 中),但在这种情况下,导航栏不会出现。

请帮助我解决这个问题,因为我不知道如何解决它。

I have a child view (not root, let it be view A) that can be rotated. Also I have a modal view (let it be view M) that is shown then a data comes in from the server. Our QA's found that if the data comes when the that view A is rotating, the modal view M will not be shown. In fact, the code to show the modal view will be executed, the app will go to the root view, but the user will not see the modal view.

The modal view M is shown with the following code:

[self.navigationController popToViewController:self.rootViewController animated:animated];    
[self performSelector:@selector(showModalAcceptDialog:) withObject:requestID afterDelay:0.1];  

(void)showModalAcceptDialog:(NSManagedObjectID*)requestID {
    RequestAcceptViewController *requestAcceptViewController = [[RequestAcceptViewController alloc] initWithNibName:@"RequestAcceptViewController" bundle:nil];
    requestAcceptViewController.requestID = requestID;
    [[self navigationController] presentModalViewController:requestAcceptViewController animated:YES];
    [requestAcceptViewController release];  
}

The delay is needed to perform navigation to the root view prior to showing the modal view. Otherwise, the app will crash with some internal exception.

Also view A in the landscape mode doesn't have a navigation bar and restores it when gets dissappeared (in viewWillDisappear), but in this case the navigation bar doesn't appear.

Please help me with this problem, because I have no idea how to fix it.

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

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

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文