gpt4 book ai didi

objective-c - Storyboard View Controller 之间的翻转转换不起作用

转载 作者:行者123 更新时间:2023-12-01 18:00:02 32 4
gpt4 key购买 nike

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


}

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

最佳答案

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

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

但请务必将您的 View 命名为 identifier " firstStoryVC "否则它将崩溃并且无法工作。

然后当你想关闭 View 时:
[self dismissModalViewControllerAnimated:YES];

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

32 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com