在missModalViewControllerAnimated之后调用presentModalViewController有问题
我有代码
- (void)matchmakerViewController:(GKMatchmakerViewController *)viewController didFindMatch:(GKMatch *)match
{
[menuViewController dismissModalViewControllerAnimated:YES];
[GameKitWrapper getSingleton].match = match;
match.delegate = [GameKitWrapper getSingleton].remotePlayer;
[menuViewController presentModalViewController:avatarSelectionViewController
animated:YES];
}
,但我有一个问题,解雇正在起作用,但现在不起作用。当我将missModalViewControllerAnimated:YES更改为dismissModalViewControllerAnimated:NO时,它起作用了,但看起来不太好。
任何帮助表示赞赏。
I have the code
- (void)matchmakerViewController:(GKMatchmakerViewController *)viewController didFindMatch:(GKMatch *)match
{
[menuViewController dismissModalViewControllerAnimated:YES];
[GameKitWrapper getSingleton].match = match;
match.delegate = [GameKitWrapper getSingleton].remotePlayer;
[menuViewController presentModalViewController:avatarSelectionViewController
animated:YES];
}
But I have the problem that the dismiss is working but not the present. When I changed dismissModalViewControllerAnimated:YES to dismissModalViewControllerAnimated:NO it worked but does not look nice.
Any help is appreciated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
@adam 有正确的想法,但你不想等待一些任意的延迟。这是很脆弱的,因为动画可能需要任何时间才能完成。您想要等待前一个视图控制器实际完成关闭。根据我的经验,放置此内容的最佳位置是当前视图控制器的
viewDidAppear:
中。这将在你的模态完全消失后被调用。有关解决类似问题的一些示例代码,请参阅此问题。@adam has the right idea, but you don't want to wait for some arbitrary delay. That's fragile because it might take any amount of time for the animation to complete. You want to wait for the previous view controller to actually finish dismissing. The best place in my experience to put this is in your current view controller's
viewDidAppear:
. That will be called after your modal has completely gone away. See this question for some example code addressing a similar problem.尝试等待一秒钟......
Try waiting for a second....
尝试先拨打:
在拨打:
Try calling:
before calling: