gpt4 book ai didi

ios - Popover 在 iPhone 中崩溃

转载 作者:行者123 更新时间:2023-11-28 18:32:46 26 4
gpt4 key购买 nike

我正在为 iPad 应用程序的弹出窗口使用以下代码。它适用于 iPad 应用程序,但当我对 iPhone 使用相同的代码时,它会崩溃

" UIPopoverController* removeDefaultPopover=[[UIPopoverController alloc]initWithContentViewController:NavController];"

任何人都可以帮助我摆脱困境..

 UIViewController  *removeDefaultController = [[UIViewController alloc] init];
UIView *removeDefaultView = [[UIView alloc] init];
removeDefaultController.view = removeDefaultView;

removeDefaultController.contentSizeForViewInPopover = CGSizeMake(100, 100);
UINavigationController *NavController=[[UINavigationController alloc]initWithRootViewController:removeDefaultController];
UIPopoverController* removeDefaultPopover=[[UIPopoverController alloc]initWithContentViewController:NavController];
UIBarButtonItem *edit = [[UIBarButtonItem alloc] initWithTitle:@"EDIT" style:UIBarButtonItemStyleBordered target:self action:@selector(editDefaultLanguage)];
[removeDefaultController.navigationItem setRightBarButtonItem:edit animated:YES];removeDefaultPopover.delegate=self;
[removeDefaultPopover presentPopoverFromRect:CGRectMake(0, 0, 100, 100) inView:self.view permittedArrowDirections:NO animated:YES];
removeDefaultView.backgroundColor=[UIColor redColor];

最佳答案

来自documentation :

Popover controllers are for use exclusively on iPad devices. Attempting to create one on other devices results in an exception.

您必须自己实现类似的功能。

关于ios - Popover 在 iPhone 中崩溃,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25036659/

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