当我使用此代码创建弹出窗口时,在使用视图控制器初始化 UIPopoverController 后会出现 sigabrt 错误

发布于 2025-01-03 19:14:40 字数 473 浏览 0 评论 0原文

当我使用此代码进行弹出窗口创建时,它在初始化后给出 sigabrt 错误 带有视图控制器的 UIPopoverController(测试2),

Test2 *pop=[[Test2 alloc]initWithNibName:@"Test2" bundle:nil];
popUpnew=[[UIPopoverController alloc] initWithContentViewController:pop];
popUpnew.delegate=self;
popUpnew.delegate=self;
popUpnew.popoverContentSize=CGSizeMake(150,75);
[popUpnew presentPopoverFromRect:mybutton.frame inView:self.view    permittedArrowDirections:
UIPopoverArrowDirectionAny animated:YES];

when i am using this code for pop up creation it is giving sigabrt error after initializing
UIPopoverController with a view controller(Test2),

Test2 *pop=[[Test2 alloc]initWithNibName:@"Test2" bundle:nil];
popUpnew=[[UIPopoverController alloc] initWithContentViewController:pop];
popUpnew.delegate=self;
popUpnew.delegate=self;
popUpnew.popoverContentSize=CGSizeMake(150,75);
[popUpnew presentPopoverFromRect:mybutton.frame inView:self.view    permittedArrowDirections:
UIPopoverArrowDirectionAny animated:YES];

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

二货你真萌 2025-01-10 19:14:40

你这里的看起来不错。您是否检查过 mybutton.frame 和 self.view 是否有效?调用presentPopoverFromRect后立即释放了吗?

您是否尝试过通过将委托设置为零来进行测试?

What you have here looks fine. Have you checked to see that mybutton.frame and self.view are valid? Did you release it immediately after calling presentPopoverFromRect?

Have you tried testing by setting the delegate to nil?

梦在深巷 2025-01-10 19:14:40

试试这个

Test2 *pop = [[Test2 alloc] initWithNibName:@"Test2" bundle:nil];
pop.modalPresentationStyle = UIModalPresentationFormSheet;
pop.modalInPopover=YES;
pop.delegate=self;
pop.contentSizeForViewInPopover=CGSizeMake(150,75);
popoverController = [[UIPopoverController alloc] initWithContentViewController:pop];
[popoverController presentPopoverFromRect:mybutton.frame inView:self.view permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES];
[pop release];

Try this

Test2 *pop = [[Test2 alloc] initWithNibName:@"Test2" bundle:nil];
pop.modalPresentationStyle = UIModalPresentationFormSheet;
pop.modalInPopover=YES;
pop.delegate=self;
pop.contentSizeForViewInPopover=CGSizeMake(150,75);
popoverController = [[UIPopoverController alloc] initWithContentViewController:pop];
[popoverController presentPopoverFromRect:mybutton.frame inView:self.view permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES];
[pop release];
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文