我在stackoverflow上发现了一些类似的问题,但它们不能解决我的问题。第一次做旋转时,我收到错误“wait_fences: failed to receive reply: 10004003”,它会被阻塞一两秒以在新方向上打印新视图,我的代码如下:
- (void)willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration: (NSTimeInterval)duration
{
if (isLandScape) {
[self toHorizontalBrowserView];
} else {
[self toVerticalBrowserView];
}
}
- (void)toHorizontalBrowserView
{
[horizontalBrowserViewController viewWillAppear:YES];
[self.activeViewController viewWillDisappear:YES];
[self.activeViewController.view removeFromSuperview];
[_viewController.centerView insertSubview: horizontalBrowserViewController.view atIndex:0];
[self.activeViewController viewDidDisappear:YES];
[horizontalBrowserViewController viewDidAppear:YES];
self.activeViewController = horizontalBrowserViewController;
}
- (void)toVerticalBrowserView
{
[verticalPhotoBrowserViewController viewWillAppear:YES];
[self.activeViewController viewWillDisappear:YES];
[self.activeViewController.view removeFromSuperview];
[_viewController.centerView insertSubview:verticalPhotoBrowserViewController.view atIndex:0];
[self.activeViewController viewDidDisappear:YES];
[verticalPhotoBrowserViewController viewDidAppear:YES];
_activeViewController = verticalPhotoBrowserViewController;
}
这个问题的原因是什么?如何解决?