我需要为我的iPhone应用程序使用UIPopOverController,我搜索了stackoverflow,有人说UIPopOverController不能在iPhone设备上运行为什么?.当我在iphone设备上运行时

 -(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];
}

有人能帮我吗?

推荐答案

Edit: As stated by Soberman, since iOS 8 it is 100 to present popovers on iPhone using public APIs, so this answer is probably not relevant anymore.


正如苹果在UIPopoverController年前的文件中所述:

Popover控制器仅用于iPad设备.

不幸的是,没有办法在iPhone应用程序中使用这个类.但是,UIPopoverController提供的功能有两个定制的第三方实现,它们增加了对iPhone的支持等等.例如,参见https://github.com/50pixels/FPPopover.

编辑:iPhone/iPad还有另一个高度可定制的popover实现,值得一看:https://github.com/nicolaschengdev/WYPopoverController.

Objective-c相关问答推荐

react 本机WebView菜单项目props 无法在iOS&>=16上使用

在哪里可以找到 iPad 示例代码

TWTweetComposeViewController 在 IOS6 中已弃用

使用正则表达式搜索 NSString

为什么 UICollectionView 的 UICollectionViewCell 没有在用户时突出显示?

将 CSS 插入 UIWebView / WKWebView 中加载的 HTML

UIRefreshControl iOS 6 xcode

如何为代码自动格式化设置 Xcode 插件

Objective C 代码是否有 github markdown 语言标识符?

调用了dismissViewControllerAnimated,但没有解除ViewController

右对齐的 UITextField 空格键在 iOS 7 中不前进光标

Facebook 的 UIActivityViewController 不显示默认文本

使用 NSMutableArray 的二维数组

iOS7过度导航栏按钮填充

CoreData 关系故障?

iOS 5:对 UIAppearance 感到好奇

Objective-c 协议前向声明

所有异常断点在模拟器上无缘无故停止

使用正则表达式查找/替换 NSString 中的子字符串

Facebook SDK 登录永远不会在 iOS 9 上回调我的应用程序