轮换:我收到错误“wait_fences:收不到回复:10004003”

时间:2012-05-29 02:47:33

标签: iphone objective-c ipad rotation

我在stackoverflow上发现了一些类似的问题,但它们无法解决我的问题。第一次轮换时,我收到错误“wait_fences:未收到回复: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;
}

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

1 个答案:

答案 0 :(得分:1)

过去我遇到过这个问题。我认为问题是你正在更新/更改视图堆栈,同时它将被动画化。尝试注释掉要删除的位并插入子视图。