iPad开发简单介绍

  • iPad开发最大的不同在于iPhone的就是屏幕控件的适配,以及横竖屏的旋转。
  • Storyboard中得SizeClass的横竖屏配置,也不支持iPad开发。

1.在控制器中得到设备的旋转方向

在 iOS8及以后,屏幕就只有旋转后屏幕尺寸之分,不再是过期的旋转方向。

  • 在iOS7及以前得到屏幕旋转方向的方法
/**// UIInterfaceOrientation ,屏幕方向UIInterfaceOrientationUnknown = UIDeviceOrientationUnknown,UIInterfaceOrientationPortrait = UIDeviceOrientationPortrait,UIInterfaceOrientationPortraitUpsideDown = UIDeviceOrientationPortraitUpsideDown,UIInterfaceOrientationLandscapeLeft = UIDeviceOrientationLandscapeRight,UIInterfaceOrientationLandscapeRight = UIDeviceOrientationLandscapeLeft*/
- (void)willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration
{// 即将旋转执行动画NSLog(@"%s", __func__);
}- (void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration
{// 即将旋转NSLog(@"%s", __func__);
}
  • 在iOS8以后,屏幕就只有屏幕之分,即当屏幕的宽大于高就是横屏,否则是竖屏。

    • iPad屏幕只有 (1024 * 768)横屏
    • (768 * 1024)竖屏
- (void)viewWillTransitionToSize:(CGSize)size withTransitionCoordinator:(id<UIViewControllerTransitionCoordinator>)coordinator
{// 1.判断是否是横屏BOOL isLandscape = size.width == 1024;// 2.设置Dock的宽度和高度// 获取屏幕旋转动画执行的时间CGFloat duration = [coordinator transitionDuration];[UIView animateWithDuration:duration animations:^{}];
}

2.iPad中Modal弹出控制器的方式和样式

Modal常见有4种呈现样式

控制器属性 modalPresentationStyle
  • UIModalPresentationFullScreen :全屏显示(默认)
  • UIModalPresentationPageSheet
    • 宽度:竖屏时的宽度(768)
    • 高度:当前屏幕的高度(填充整个高度)
  • 横屏

  • 竖屏

  • UIModalPresentationFormSheet :占据屏幕中间的一小块

  • 横屏

  • 竖屏

  • UIModalPresentationCurrentContext :跟随父控制器的呈现样式

Modal一共4种过渡样式

控制器属性 modalTransitionStyle
  • UIModalTransitionStyleCoverVertical :从底部往上钻(默认)
  • UIModalTransitionStyleFlipHorizontal :三维翻转
  • UIModalTransitionStyleCrossDissolve :淡入淡出
  • UIModalTransitionStylePartialCurl :翻页(只显示部分,使用前提:呈现样式必须是UIModalPresentationFullScreen)
  • UIModalPresentationCustom
  • UIModalPresentationOverFullScreen
  • UIModalPresentationOverCurrentContext
  • UIModalPresentationPopover //iOS8之后过渡样式pop样式
  • UIModalPresentationNone

3. iPad特有的UIPopoverController的使用

案例:

情景① 在导航栏上添加leftBarButtonItem按钮,然后弹出UIPopoverController

  • 创建UIPopoverController控制器的内容控制器添加到UIPopoverController上
1>设置内容控制器(并需先创建内容控制器)
  • 强调UIPopoverController不是继承UIViewController,也就不具备显示功能,要设置内容,使用initWithContentViewController设置内容
- (id)initWithContentViewController:(UIViewController *)viewController;- (void)setContentViewController:(UIViewController *)viewController animated:(BOOL)animated;@property (nonatomic, retain) UIViewController *contentViewController;
2>设置尺寸
  • 设置popView的大小(默认控制器有多大就显示多大)(120, 44 * 3)

    • UIPopoverController的方法popoverContentSize
    • 内容控制器中设置的方法
      • self.preferredContentSize
      • self.contentSizeForViewInPopover /ios7过时/
3>设置在什么地方显示
  • 调用方法
/***  弹出UIPopoverController的方法(一)**  @param item            围绕着哪个UIBarButtonItem显示*  @param arrowDirections 箭头的方向*  @param animated        是否通过动画显示出来*/
- (void)presentPopoverFromBarButtonItem:(UIBarButtonItem *)item permittedArrowDirections:(UIPopoverArrowDirection)arrowDirections animated:(BOOL)animated;

情景② 在导航控制器的View上添加个按钮,点击,弹出一个UIPopoverController控制器,然后这个控制器再用导航控制器包装,显示二级控制器

  • 1>调用方法
/***  弹出UIPopoverController**  @param rect            指定箭头所指区域的矩形框范围(位置和尺寸)*  @param view            rect参数是以view的左上角为坐标原点(0,0)*  @param arrowDirections 箭头的方向*  @param animated        是否通过动画显示出来*/
- (void)presentPopoverFromRect:(CGRect)rect inView:(UIView *)view permittedArrowDirections:(UIPopoverArrowDirection)arrowDirections animated:(BOOL)animated;
  • 2>控制器内,有自己的逻辑结构(和正常控制器一样可以跳转返回等)

UIPopoverController消失,

  • 方法
[Popover dismissPopoverAnimated:YES]

4.iPad特有的UISplitViewController的使用

a.masterViewController

  • 1>masterViewController(主要控制器)
  • 2>负责展示主要的菜单内容

b.detailViewController

  • 1>detailViewController(详情控制器)
  • 2>负责展示详细内容

转载于:https://www.cnblogs.com/ShaoYinling/p/4790243.html

iOS---iPad开发及iPad特有的特技相关推荐

  1. iPad开发(相对于iPhone开发时专有的API)

    iPad开发 一.iPad开发简介 1.什么是iPad 一款苹果公司于2010年发布的平板电脑 定价介于苹果的智能手机iPhone和笔记本电脑产品之间 跟iPhone一样,搭载的是iOS操作系统 2. ...

  2. iOS(iPhone,iPad))开发(Objective-C)开发库常用库索引

    http://www.code4app.com 这网站不错,收集各种 iOS App 开发可以用到的代码示例  http://www.cocoacontrols.com/ 英文版本的lib收集  ht ...

  3. iOS(iPhone,iPad))开发(Obje…

    原文地址:iOS(iPhone,iPad))开发(Objective-C)开发库常用库索引 作者:子木潇雨 http://www.code4app.com 这网站不错,收集各种 iOS App 开发可 ...

  4. iPad应用开发实践指南:菜鸟如何用ios 5开发ipad上的复杂应用程序

    <iPad应用开发实践指南>前言 2011年10月,苹果公司首席执行官Tim Cook公布了有关iPad的一些有趣数据,包括: 财富500强公司有92%在测试或部署iPad: 美国本土80 ...

  5. iPhone与iPad开发实战——iOS 经典应用剖析视频--观看地址

    iPhone与iPad开发实战--iOS 经典应用剖析视频 试看地址:http://v.51work6.com/courseInfoRedirect.do?action=courseInfo& ...

  6. 如何用ios 5开发ipad上的复杂应用程序

    2011年10月,苹果公司首席执行官Tim Cook公布了有关iPad的一些有趣数据,包括: 财富500强公司有92%在测试或部署iPad: 美国本土80%的医院在测试或用iPad控制流程: 美国的每 ...

  7. iOS iPad开发~笔记 01

    //联系人:石虎  QQ: 1224614774昵称:嗡嘛呢叭咪哄 IPAD 一.iPad开发 1. 了解什么是iPad 2.掌握iphone与ipad的开发时区别(尺寸.点.排版.键盘.API.屏幕 ...

  8. 在Win7上用VMWare搭建iOS/iPad开发环境

    本文记录了在Win7上用VMWare 9安装Mac OS X Lion 10.7.5的过程,如果你想学习观摩一下iOS的开发,并且和我一样是无MAC的码农屌丝,可以参考一下. 1.物理机配置及操作系统 ...

  9. 《深入浅出iPhone/iPad开发(第2版)》——在Xcode中建立你的界面

    本节书摘来自异步社区<深入浅出iPhone/iPad开发(第2版)>一书中的在Xcode中建立你的界面,作者 [美]Dan Pilone , Tracey Pilone,更多章节内容可以访 ...

最新文章

  1. Java---定义一个圆(Circle)类表示三维空间中的圆(两个成员变量:圆心Point类、半径)
  2. Host 'controller' is not mapped to any cell
  3. Dev-C++实现调试功能
  4. 【渝粤题库】广东开放大学 大学英语B 形成性考核 (2)
  5. python 读取元组对的key_Python基本认识基本类型
  6. 微星组件环境linux,微星笔记本常用系统环境组件下载集合
  7. 利用公网Msf+MS17010跨网段攻击内网
  8. Python开发【模块】:Urllib(二)
  9. 神经网络之父Hinton介绍及其论文介绍
  10. 程序设计方法与技术——C语言 程序设计概述
  11. 荣联 云通讯 发送短信通知 node
  12. Appium报错Original error: Could not proxy command to the remote server. Original error: socket hang up
  13. halcon—利用顶帽操作减轻图像灰度不均匀对二值化的影响
  14. Component template should contain exactly one root element
  15. 泰拉瑞亚 (Terraria v1.4.1.2) ---PC
  16. java程序员烂大街了吗?java入坑之前先来看看行情
  17. linux查看block大小命令,Linux/Centos下多种方法查看系统block size大小
  18. 【无标题】BIGEMAP中打开高清卫星影像谷歌地球
  19. 二手机器人进口报关_日本二手机器人进口报关案例:进口中检及清关流程
  20. Xamarin实现将图片设置为启动页——Xamarin.forms(二)

热门文章

  1. Scala函数的调用过程分析
  2. Java的agent机制简述
  3. 装配图中齿轮的画法_春季高考机械专业中机械制图考什么?重点是什么?
  4. python读取文本并且替换_lin如何读取和替换python行文件中的文本
  5. bentley 二次开发_Bentley的基本概念
  6. BCompare日志
  7. 《高效能人士的七个习惯》
  8. 【已解决】Win7搭建Python环境:Eclipse + PyDev插件
  9. Mjpeg‐stream移植
  10. java中的解码和编码_关于java中编码和解码(一)