在设置故事板之间的翻转过渡时遇到很多麻烦。调用以下方法时,应用崩溃。我收到错误消息:
[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];


}

我将不胜感激。

最佳答案

由于您正在使用情节提要。这更准确,请尝试以下操作:

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

但是请确保将视图的identifier命名为“ firstStoryVC ”,否则它将崩溃并且无法正常工作。

然后,当您想取消视图时:
[self dismissModalViewControllerAnimated:YES];

关于objective-c - Storyboard View Controller 之间的翻转转换不起作用,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/11385761/

10-13 21:28