1

我在设置故事板之间的翻转过渡时遇到了很多麻烦。调用以下方法时应用程序崩溃。我收到错误消息:

[NSPathStore2 setView:]: unrecognized selector sent to instance...

这是我的代码:

- (void)advanceToNextViewController {

    humptyDumptyViewController *controller = [self.storyboard instantiateViewControllerWithIdentifier:@"firstStoryVC"];
     /*
    [self.navigationController pushViewController:controller animated:YES];
    */
    [UIView beginAnimations:@"animation" context:nil];
    [self.navigationController pushViewController:controller animated:NO]; 
    [UIView setAnimationTransition:UIViewAnimationTransitionFlipFromLeft forView:self.navigationController.view cache:NO]; 
    [UIView commitAnimations];


}

我很感激这方面的任何帮助。

4

2 回答 2

3

由于您使用的是故事板。这更准确,试试这个:

UIStoryboard *sb = [UIStoryboard storyboardWithName:@"MainStoryboard" bundle:nil];
UIViewController *vc = [sb instantiateViewControllerWithIdentifier:@"firstStoryVC"];
vc.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;
[self presentViewController:vc animated:YES completion:NULL];

但请务必将您的视图命名为identifierfirstStoryVC ”,否则它会崩溃并且无法工作。

然后当你想关闭视图时:

[self dismissModalViewControllerAnimated:YES];
于 2012-07-09T14:21:28.720 回答
2

试试这个,它会让你完全控制时间和动画。

humptyDumptyViewController *controller = [self.storyboardinstantiateViewControllerWithIdentifier:@"firstStoryVC"];
[UIView  beginAnimations:nil context:NULL];
[UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];
[UIView setAnimationDuration:0.75];
[self.navigationController pushViewController:controller animated:NO];
[UIView setAnimationTransition:UIViewAnimationTransitionFlipFromLeft forView:self.navigationController.view cache:NO];
[UIView commitAnimations];
于 2012-07-09T11:33:10.433 回答