gpt4 book ai didi

ios - UIModalTransitionStylePartialCurl 使我的应用程序崩溃

转载 作者:行者123 更新时间:2023-12-01 21:58:34 26 4
gpt4 key购买 nike

这是我的 viewController.m 文件

- (IBAction)defaultAction:(id)sender {
SimpleViewController *simpleView = [[SimpleViewController alloc]init];
[self presentViewController:simpleView animated:YES completion:nil];
}

- (IBAction)flipAction:(id)sender {
SimpleViewController *simpleView = [[SimpleViewController alloc]init];
[simpleView setModalTransitionStyle:UIModalTransitionStyleFlipHorizontal];
[self presentViewController:simpleView animated:YES completion:nil];

}

- (IBAction)dissolveAction:(id)sender {
SimpleViewController *simpleView = [[SimpleViewController alloc]init];
[simpleView setModalTransitionStyle:UIModalTransitionStyleCrossDissolve];
[self presentViewController:simpleView animated:YES completion:nil];
}



- (IBAction)pageCurlAction:(id)sender {

SimpleViewController *simpleView = [[SimpleViewController alloc]init];
[simpleView setModalTransitionStyle:UIModalTransitionStylePartialCurl];
[self presentViewController:simpleView animated:YES completion:nil];

}

我有另一个类 SimpleViewController。这个类中有一个像这样的按钮操作。
- (IBAction)dismissMeAction:(id)sender {
[self dismissViewControllerAnimated:YES completion:nil];
}

我的默认、翻转和溶解按钮效果很好,但是当我单击 pageCurl 时,我的应用程序崩溃了。这背后的原因是什么?

最佳答案

UIModalTransitionStylePartialCurl是一种需要额外特殊配置的样式。这是来自Apple的文档:

Declaration

UIModalTransitionStylePartialCurl Discussion

When the view controller is presented, one corner of the current view curls up to reveal the presented view underneath. On dismissal, the curled up page unfurls itself back on top of the presented view. A view controller presented using this transition is itself prevented from presenting any additional view controllers. This transition style is supported only if the parent view controller is presenting a full-screen view and you use the UIModalPresentationFullScreen modal presentation style. Attempting to use a different form factor for the parent view or a different presentation style triggers an exception.



所以你必须确保你的 self view 是全屏的,添加全屏演示样式到 simpleView如下

- (IBAction)pageCurlAction:(id)sender {

SimpleViewController *simpleView = [[SimpleViewController alloc]init];
[simpleView setModalPresentationStyle:UIModalPresentationFullScreen];
[simpleView setModalTransitionStyle:UIModalTransitionStylePartialCurl];
[self presentViewController:simpleView animated:YES completion:nil];

}

关于ios - UIModalTransitionStylePartialCurl 使我的应用程序崩溃,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60797165/

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