UIPopoverController for iphone无法正常工作? [英] UIPopoverController for iphone not working?
问题描述
我需要为我的iPhone应用程序使用UIPopOverController,我搜索stackoverflow有人说UIPopoverController不能在iphone设备上运行为什么?。当我在iphone设备上运行时
i得到此错误 reason :' - [UIPopoverController initWithContentViewController:]
在未在UIUserInterfaceIdiomPad下运行时调用。'
I need to use a UIPopOverController for my iPhone app ,i searched stackoverflow someone said UIPopoverController does not run on iphone iphone device WHY?.when i run on iphone device
i got this error reason: '-[UIPopoverController initWithContentViewController:]
called when not running under UIUserInterfaceIdiomPad.'
-(void)btnSetRemainderTapped:(UIButton *)button
{
setReminderView =[[SetRemainderView alloc]initWithNibName:@"SetRemainderView" bundle:[NSBundle mainBundle]];
setReminderView.contentSizeForViewInPopover = CGSizeMake(setReminderView.view.frame.size.width, setReminderView.view.frame.size.height);
setReminderView.delegate = self;
popOverController = [[UIPopoverController alloc]
initWithContentViewController:setReminderView] ;
CGRect rect = CGRectMake(self.view.frame.size.width/2, self.view.frame.size.height/2, 1, 1);
[popOverController presentPopoverFromRect:rect
inView:self.view
permittedArrowDirections:UIPopoverArrowDirectionAny
animated:YES];
}
任何人都可以帮助我吗?
can any one help me?
推荐答案
编辑:正如Soberman所述,自iOS 8以来它是可能使用公共API在iPhone上展示popovers,所以这个答案可能不再适用了。
As stated by Soberman, since iOS 8 it is possible to present popovers on iPhone using public APIs, so this answer is probably not relevant anymore.
正如Apple关于 UIPopoverController :
Popover控制器仅适用于iPad设备。
Popover controllers are for use exclusively on iPad devices.
因此,不幸的是,无法在iPhone应用程序中使用此类。但是UIPopoverController提供了一些定制的第三方实现功能,可以添加iPhone支持等等。例如,请参见 https://github.com/50pixels/FPPopover 。
So there is no way to use this class in iPhone application unfortunately. But there are a couple of custom third-party implementations of the functionality provided by UIPopoverController which add iPhone support and more. See https://github.com/50pixels/FPPopover for example.
编辑:还有另一个高度可定制的popover实现,适用于值得检出的iPhone / iPad: https://github.com/nicolaschengdev/WYPopoverController 。
There also is another highly customizable popover implementation for both iPhone/iPad worth checking out: https://github.com/nicolaschengdev/WYPopoverController.
这篇关于UIPopoverController for iphone无法正常工作?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!