旋转视图时模式对话框出现问题
我有一个可以旋转的子视图(不是根视图,让它成为视图 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论