2

我在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;
}

这个问题的原因是什么?如何解决?

4

1 回答 1

1

我过去有这个问题。我认为问题在于您在动画时正在更新/更改视图堆栈。尝试注释掉要删除和插入子视图的位。

于 2012-05-29T03:38:51.913 回答