2

我有一个视图控制器,它在viewDidLoad. 我有一个观察者检查视频何时完成以及当它检测到视频完成时调用一个方法,该方法将视图控制器推入堆栈。但是,当调用此方法时,控制台中会出现以下错误:

*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[NSPathStore2 setView:]: unrecognized selector sent to instance 0xc6ef8e0'

我使用的代码如下所示:

....
....
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(advanceToNextView) name:MPMoviePlayerPlaybackDidFinishNotification object:player];  
....
....
- (void) advanceToNextView {

    UIViewController *controller = [self.storyboard instantiateViewControllerWithIdentifier:@"spoonVC"];


    [self.navigationController pushViewController:controller animated:NO];
    [UIView setAnimationTransition:UIViewAnimationTransitionCurlUp forView:self.navigationController.view cache:NO];
    [UIView commitAnimations];

}

我不知道我做错了什么。我已经检查并仔细检查了故事板标识符是否正确。

4

2 回答 2

3

替换您的此代码:

[self.navigationController pushViewController:controller animated:NO];

经过:

 [self.navigationController pushViewController:controller animated:YES];
于 2012-09-11T06:43:52.930 回答
0

它找到了解决方案。制作过渡动画的方式似乎并不一致,但以下似乎对我来说效果很好。

UIViewController *controller = [self.storyboard instantiateViewControllerWithIdentifier:@"page2"];
    [UIView beginAnimations:@"Flip transition" context:nil];
    [UIView setAnimationDuration:0.80];
    [UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];
    [UIView setAnimationTransition:
     UIViewAnimationTransitionCurlDown
                           forView:self.navigationController.view cache:NO];
    [self.navigationController pushViewController:controller animated:YES];
    [UIView commitAnimations];
于 2012-09-09T09:47:46.947 回答