分享功能使用的UIPopoverController在iOS9 过期,替换为popoverPresentationController
2015-11-20 17:54
471 查看
记录一下 以备以后用到的时候拿出来看看。 以前使用的:
if (UIDevice.currentDevice().userInterfaceIdiom == UIUserInterfaceIdiom.Phone) { presentViewController(vc, animated: true, completion: nil) } else if (popover == nil || !popover!.popoverVisible) { popover = UIPopoverController(contentViewController: vc) popover!.delegate = self popover?.presentPopoverFromRect(inviteView.frame, inView: self.view, permittedArrowDirections: UIPopoverArrowDirection.Any, animated: true)
现在使用: if #available(iOS 8.0, *) { vc.modalPresentationStyle = UIModalPresentationStyle.Popover vc.popoverPresentationController?.sourceView = inviteView vc.popoverPresentationController?.sourceRect = inviteView.bounds vc.popoverPresentationController?.permittedArrowDirections = UIPopoverArrowDirection.Any presentViewController(vc, animated: true, completion: nil) } else { //DeviceUtils.isIOS7() if (UIDevice.currentDevice().userInterfaceIdiom == UIUserInterfaceIdiom.Phone) { presentViewController(vc, animated: true, completion: nil) } else if (popover == nil || !popover!.popoverVisible) { popover = UIPopoverController(contentViewController: vc) popover!.delegate = self popover?.presentPopoverFromRect(inviteView.frame, inView: self.view, permittedArrowDirections: UIPopoverArrowDirection.Any, animated: true) } // Fallback on earlier versions }
相关文章推荐
- Thread 暂停 继续(to be continued)
- iOS开发UI基础—手写控件,frame,center和bounds属性
- 获取iOS系统版本 --- UIDevice的使用
- UIPickerView的点滴
- adoquery 查询
- String、StringBuffer and StringBuilder
- 解决javax.persistence.TransactionRequiredException: Executing an update/delete query错误
- UIPickerView的点滴
- UIbutton
- label不同颜色不同字体及加删除线
- UIlabel以及其UIfont
- 创建rabbitmq:virtual host、exchange、queue
- TestStand与LabVIEW UI 交互
- iOS: 使用CGContextRef,CGPath和UIBezierPath来绘画
- 百度ue富文本编辑器setContent方法报错
- UIViewController的生命周期
- UniGui中使用Grid++Report报表控件子报表获取数据的方法
- easyui常用控件常用方法
- MyBatis+Gson+Jersey+EasyUI的增删改例子
- Codeforces Beta Round #85 (Div. 1 Only) A. Petya and Inequiations 贪心