iOS iOS8新特性--UIPopoverPresentationController
1.回顾UIPopoverController的使用,下面这份代码只能在ipad下运行
// 初始化控制器,SecondViewController类继承自UIViewController
SecondViewController *vc = [[SecondViewController alloc] init];
// 把vc包装成UIPopoverController
UIPopoverController *popover = [[UIPopoverController alloc] initWithContentViewController:vc];
// 设置popover的指向,
// 指向当前控制上button按钮,所以FromRect后跟bounds
// 如果是指向当前控制的View,则FromRect后跟frame
[popover presentPopoverFromRect:self.button.bounds inView:self.button permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES];
2. 运用UIPopoverPresentationController,下面这份代码在iphone和ipad中,都可以正常运行
2.1 在iphone中是常见的modal方式,也就是从屏幕底部爬上来,而在ipad中,是popover的那种方式
// 初始化控制器
SecondViewController *vc = [[SecondViewController alloc] init];
// modal出来是个popover
vc.modalPresentationStyle = UIModalPresentationPopover;
// 取出vc所在的UIPopoverPresentationController
vc.popoverPresentationController.sourceView = self.button;
vc.popoverPresentationController.sourceRect = self.button.bounds;
[self presentViewController:vc animated:YES completion:nil];
2.2 在iphone中,上面这份代码等同于下面:
2.3 苹果在iOS8中对UIViewController做了类扩展
也就是说popoverPresentationController是UIViewController的属性
modalPresentationStyle是UIViewController成员变量
UIPopoverPresentationController继承自UIPresentationController, UIPresentationController又继承自NSObject
iOS iOS8新特性--UIPopoverPresentationController的更多相关文章
- iOS8新特性(1)——UIAlertController
一.iOS8介绍 iOS8 新特性,主要是UI上进行了统一 1.UIAlertController 2.UIPresentaionController:管理所有通过modal出来的控制器(看笔记) 3 ...
- iOS8 新特性
iOS8新特性主要体现在4方面 1.UIAlertController 对alert&actionSheet的封装 UIAlertController.h 提示框按钮的选择 typedef N ...
- iOS 9应用开发教程之iOS 9新特性
iOS 9应用开发教程之iOS 9新特性 iOS 9开发概述 iOS 9是目前苹果公司用于苹果手机和苹果平板电脑的最新的操作系统.该操作系统于2015年6月8号(美国时间)被发布.本章将主要讲解iOS ...
- iOS8新特性(1)-UIPopoverPresentationController使用
从iOS 8开始,苹果提出新的 UIPopoverPresentationController代替UIPopoverController: 新的UIPopoverPresentationControl ...
- iOS 8 新特性
这篇文章会介绍iOS8开发相关的主要特性. App 插件 通过支持插件,iOS8让我们可以系统指定的区域进行扩展,也就是为用户的特定需求提供自定义的方法.例如:可以通过App插件帮助用户分享他们的内容 ...
- iOS开发——新特性OC篇&Swift 2.0新特性
Swift 2.0新特性 转眼间,Swift已经一岁多了,这门新鲜.语法时尚.类型安全.执行速度更快的语言已经渐渐的深入广大开发者的心.我同样也是非常喜爱这门新的编程语言. 今年6月,一年一度 ...
- ios8新特性widget开发-b
os8发布已经有一段时间了,伴随着ios8同时也出现了许多新的特性,ios系统将会越来越开放,这是好事.其中一个新特性就是在下拉通知栏里加入了个性的widget,开发者可以自己定义widget的样式内 ...
- iOS -- iOS11新特性,如何适配iOS11
前言 这几天抽空把WWDC的Session看了一些,总结了一些iOS11新的特性,可能对我们的App有影响,需要我们进行适配.本文作为一个总结. 本文内容包括:集成了搜索的大标题栏.横向选项卡栏.Ma ...
- iOS开发——新特性OC篇&IOS9 系统新特性
IOS9 系统新特性 2015年6月89号凌晨召开的WWDC 2015苹果开发者大会发布了全新的iOS 9系统,PC6小编今天给大家整理了这次iOS9的系统更新带来了哪些新的功能与升级,本次新功能一览 ...
随机推荐
- [jQuery编程挑战]006 生成一个倒计时效果
<!DOCTYPE html> <html lang="zh"> <head> <meta charset="utf-8&quo ...
- dedecms设置文章分页后,标题会带有序号的解决方法
至于删除分页后标题后面的序号,找到include/arc.archives.class.php 打开,找到 if($i>1) $this->Fields['title'] = $this- ...
- Drupal7安装完整教程
Drupal7 史前准备工作(安装 AppServ)AppServ 是 PHP 网页架站工具组合包,作者将一些网络上免费的架站资源重新包装成单一的安装程序,以方便初学者快速完成架站,AppServ 所 ...
- YII 框架使用之——创建应用
linux环境为UBUNTU14.04,YII框架的版本是1.1.17 将下载的YII解压缩,压缩后会有三个文件夹,”demos,requirements,framework”,demos 当然就是演 ...
- Node.js快速入门
Node.js是什么? Node.js是建立在谷歌Chrome的JavaScript引擎(V8引擎)的Web应用程序框架. 它的最新版本是:v0.12.7(在编写本教程时的版本).Node.js在官方 ...
- [BZOJ 2165] 大楼 【DP + 倍增 + 二进制】
题目链接:BZOJ - 2165 题目分析: 这道题我读了题之后就想不出来怎么做,题解也找不到,于是就请教了黄学长,黄学长立刻秒掉了这道题,然后我再看他的题解才写出来..Orz 使用 DP + 倍增 ...
- 修改weblogic jvm启动参数
进入: D:\Oracle\Middleware\user_projects\domains\base_domain\startWebLogic.cmd 在call 上一行增加: set USER_M ...
- yum仅下载RPM包不安装
http://www.ttlsa.com/linux/howto-yum-download-rpm-without-install/
- struts2之防止表单重复提交
struts.xml配置文件 <?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE struts ...
- 物理卷操作命令:pvcreate,pvscan,pvdisplay.卷组操作命令:vgcreate,vgdisplay.
新硬盘创建LVM系统过程. 物理卷操作命令:pvcreate,pvscan,pvdisplay. 卷组操作命令:vgcreate,vgdisplay. 逻辑卷操作命令:lvcreate,lvdispl ...