iOS8下,UIImagePickerController的popoverPresentationController为空,要怎么获取?
2015-09-19 16:31
459 查看
想popover一个UIImagePickerController,结果发现UIImagePickerController的popoverPresentationController为空,怎么办?
在iOS8中,需要设置UIImagePickerController的modalPresentationStyle,如下:
然后,就可以使用popoverPresentationController了。如下:
注意:代码中sourceRect一定要使用bounds,而不能使用frame,不这么用的话,小心弹出的控制器的位置有问题。
在iOS8中,需要设置UIImagePickerController的modalPresentationStyle,如下:
imagePickerController.modalPresentationStyle = UIModalPresentationPopover;
然后,就可以使用popoverPresentationController了。如下:
UIPopoverPresentationController *popPC = imagePickerController.popoverPresentationController; popPC.sourceView = imageView; popPC.sourceRect = imageView.bounds; [self presentViewController:imagePickerController animated:YES completion:nil];
注意:代码中sourceRect一定要使用bounds,而不能使用frame,不这么用的话,小心弹出的控制器的位置有问题。
相关文章推荐
- UITableView/UITabBarController/可视化编程/自动布局
- iOS 使用UIDocumentInteractionController类打开文件
- java学习笔记图形程序设计及GUI应用小结(1)
- UEditor和CKEditor配置上传图片,视频,附件
- 客户端GUI程序开发漫谈
- UIView 中autoresizingMask的属性
- 点击UITableView的cell展开收缩
- UIScrollView pagingEnabled自定义翻页宽度
- 多线程工具之NSOperationQueue
- 进行水印的添加
- PHP中include和require的区别详解
- 基于信号量与P/V操作同步机制的读者/写者问题的设计与实现 (写者优先)
- UIScrollView总结
- UIView总结:
- java.util.Queue用法
- Scala深入浅出实战经典:39,ListBuffer、ArrayBuffer、Queue、Stack操作代码实战
- C#串口控制舵机、arduino源码 及C#源码及界面
- Distinct Subsequences
- bluetooth-蓝牙事件监听
- Android UI与资源总结(一)