UIkit框架之uiUIapplication
1.继承链:uiresponder:NSObject
2.使用 sharedApplication方法来存取对象
3.这个类可以遵守协议是UIApplicationDelegate
4.获取app的实例
(1)+ (UIApplication *)sharedApplication :返回单个app实例
5.获取app委托
(1)@property(nonatomic, assign) id< UIApplicationDelegate> delegate :设置委托
6.获取app窗口
(1)@property(nonatomic, readonly) UIWindow*keyWindow :app的关键窗口
(2)@property(nonatomic, readonly) NSArray<__kindof UIWindow *> *windows :返回app可见的,隐藏的窗口组成的数组
7.控制和控制事件
(1)- (void)sendEvent:(UIEvent *)event
:给app里面合适的响应对象派遣事件
(2)- (BOOL)sendAction:(SEL)action
to:(id)target
from:(id)sender
forEvent:(UIEvent *)event
:
action |
A selector identifying an action method. See the discussion for information on the permitted selector forms. |
target |
The object to receive the action message. If |
sender |
The object that is sending the action message. The default sender is the |
event |
A |
(3)- (void)beginIgnoringInteractionEvents :开始动画和转换之前调用这个方法通知接收者延迟处理和触摸相关的事件
(4)- (void)endIgnoringInteractionEvents :调用上面的方法、动画或者转换之后调用这个方法通知接收者重新处理和触摸相关的事件
(5)- (BOOL)isIgnoringInteractionEvents :返回布尔值是否让接收者忽视由屏幕上出现的触摸事件
(6)@property(nonatomic) BOOL applicationSupportsShakeToEdit :一个布尔值决定了设备摇动是否可以显示undo-redo user interface
8.打开一个URL资源
(1)- (BOOL)openURL:(NSURL *)url
:尝试打开指定的URL,返回的值确定是否能够打开
(2)- (BOOL)canOpenURL:(NSURL *)url
:返回布尔值确定app是否能够打开某个指定的URL路径
9.配置用户通知设置
(1)- (void)registerUserNotificationSettings:(UIUserNotificationSettings *)notificationSettings
:注册通知偏好
(2)- (UIUserNotificationSettings *)currentUserNotificationSettings :返回当前为app设置的通知设置
10.注册远程的通知
(1)- (void)registerForRemoteNotifications :登记远程的通知
(2)- (void)unregisterForRemoteNotifications :拒绝接受任何的远程通知
(3)- (BOOL)isRegisteredForRemoteNotifications :返回布尔值确定当前登记的是否为远程通知
11.登记本地通知
(1)- (void)scheduleLocalNotification:(UILocalNotification *)notification
:传递本地封装的时间通知
(2)- (void)presentLocalNotificationNow:(UILocalNotification *)notification
:立即显示本地的通知
(3)- (void)cancelLocalNotification:(UILocalNotification *)notification
:取消传递指定的本地时间表通知
(4)@property(nonatomic, copy) NSArray<UILocalNotification *> *scheduledLocalNotifications :所有当前时间表的本地通知
12.管理后台执行
(1)@property(nonatomic, readonly) UIApplicationStateapplicationState :app运行时的状态
(2)@property(nonatomic, readonly) NSTimeIntervalbackgroundTimeRemaining :app在后台运行的时间
(3)@property(nonatomic, readonly) UIBackgroundRefreshStatusbackgroundRefreshStatus :有能力在后台执行的程序
(4)- (void)setMinimumBackgroundFetchInterval:(NSTimeInterval)minimumBackgroundFetchInterval
:指定程序等待执行的时间
(5)- (UIBackgroundTaskIdentifier)beginBackgroundTaskWithName:(NSString *)taskName
expirationHandler:(void (^)(void))handler
:使用指定name来标志一个新的长时间运行的后台任务
(6)-(UIBackgroundTaskIdentifier)beginBackgroundTaskWithExpirationHandler:(void (^)(void))handler
:标示一个新长时间运行的后台任务的开始
(7)- (void)endBackgroundTask:(UIBackgroundTaskIdentifier)identifier
:标示指定的后台任务已经结束
13.管理app的闲置时间
(1)@property(nonatomic, getter=isIdleTimerDisabled) BOOL idleTimerDisabled :闲置时间是否能够为app所用
14.管理恢复行为的状态
(1)- (void)extendStateRestoration :告诉app代码开始异步恢复状态
(2)- (void)completeStateRestoration :告诉app已经异步恢复了状态
(3)- (void)ignoreSnapshotOnNextApplicationLaunch :Prevents the app from using the recent snapshot image during the next launch cycle.
(4)+ (void)registerObjectForStateRestoration:(id<UIStateRestoring>)object
restorationIdentifier:(NSString *)restorationIdentifier
:为状态恢复系统注册一个自定义对象
15.管理Home Screen Quick Actions for 3D Touch
(1)@property(nonatomic, copy) NSArray<UIApplicationShortcutItem *> *shortcutItems :Set this property to register an array of dynamic quick actions to display on the Home screen when a user presses your app icon.
16.决定可以保护的内容
(1)@property(nonatomic, readonly, getter=isProtectedDataAvailable) BOOL protectedDataAvailable :返回值确定内容是否是被保护的
17.注册远程控制事件
(1)- (void)beginReceivingRemoteControlEvents :告诉app开始接受远程控制事件
(2)- (void)endReceivingRemoteControlEvents :告诉app结束接受远程控制事件
18.控制app的显示
(1)@property(nonatomic, readonly) CGRectstatusBarFrame :读取状态栏的位置和大小
(2)@property(nonatomic, getter=isNetworkActivityIndicatorVisible) BOOL networkActivityIndicatorVisible :网络是否能够使用
(3)@property(nonatomic) NSIntegerapplicationIconBadgeNumber :The number currently set as the badge of the app icon in Springboard.
(4)@property(nonatomic, readonly) UIUserInterfaceLayoutDirectionuserInterfaceLayoutDirection :返回用户界面的布局方向
18.获取字体大小偏好
(1)@property(nonatomic, readonly) NSString*preferredContentSizeCategory :用户更加喜欢的字体大小选择
19.管理默认的界面方向
(1)- (UIInterfaceOrientationMask)supportedInterfaceOrientationsForWindow:(UIWindow *)window
:返回指定窗口支持的界面方向
20.管理状态栏的方向
(1)@property(nonatomic, readonly) NSTimeIntervalstatusBarOrientationAnimationDuration :当设备90度转变的时候状态栏的动画转换
21.数据类型
(1)UIStatusBarStyle类型
UIStatusBarStyleDefault, :黑色的状态栏
UIStatusBarStyleLightContent, :光亮的状态栏
UIStatusBarStyleBlackTranslucent, :黑色透明的状态栏
UIStatusBarStyleBlackOpaque :黑色不透明的状态栏
(2)UIStatusBarAnimation类型
UIStatusBarAnimationNone, :状态栏显示和隐藏的时候没有动画
UIStatusBarAnimationFade, :状态栏显示和隐藏的时候使用渐隐渐现的动画
UIStatusBarAnimationSlide, :状态栏显示和隐藏的时候使用滑动的动画
UIBackgroundFetchResultNewData, :新的数据成功载入
UIBackgroundFetchResultNoData, :没有新的数据可以载入
UIBackgroundFetchResultFailed :数据载入失败
23.通知
(1)UIApplicationBackgroundRefreshStatusDidChangeNotification :当backgroundRefreshStatus属性的值发生变化的时候就会发送这个通知
(2)UIApplicationDidBecomeActiveNotification :当app将要成为活跃状态的时候就会发送这个通知
(3)UIApplicationDidChangeStatusBarFrameNotification :当状态栏的frame发生改变结束的时候就会发送这个通知
(4)UIApplicationDidChangeStatusBarOrientationNotification :当app的用户界面的方向发生改变的时候就会发送这个通知
(5)UIApplicationDidEnterBackgroundNotification :当app进行后台的时候就会发送这个通知
(6)UIApplicationDidFinishLaunchingNotification :当app结束启动的时候就会发送这个通知
(7)UIApplicationDidReceiveMemoryWarningNotification :当可用运行内存不足的时候就会发送这个通知
(8)UIApplicationProtectedDataDidBecomeAvailable :当受保护的文件已经可以被使用的时候就会发送这个通知
(9)UIApplicationProtectedDataWillBecomeUnavailable :当受保护的文件被锁住变得不可以使用的时候就会发送这个通知
(10)UIApplicationSignificantTimeChangeNotification :当有重大的时间发生改变的时候就会发送这个通知,如改变到新的一天
(11)UIApplicationUserDidTakeScreenshotNotification :当按下home键和按钮来截图的时候就会发送这个通知
(12)UIApplicationWillChangeStatusBarOrientationNotification :当app改变了界面的方向的时候就会发送这个通知
(13)UIApplicationWillChangeStatusBarFrameNotification :当状态栏的frame开始发生改变的时候就会发送这个通知
(14)UIApplicationWillEnterForegroundNotification :当app将要从后台活跃到前端的时候就会发送这个通知
(15)UIApplicationWillResignActiveNotification :当app不再活跃或者失去关注的时候就会发送这个通知
(16)UIApplicationWillTerminateNotification :当app要终止的时候就会发送这个通知
(17)UIContentSizeCategoryDidChangeNotification :当用户改变设定的内容大小的时候就会发送这个通知
UIkit框架之uiUIapplication的更多相关文章
- Swift - 重写UIKit框架类的init初始化方法(以UITabBarController为例)
原来写了篇文章讲UITabBarController的用法,当时是从UIViewController跳转到UITabBarController页面,代码如下: 1 self.presentViewCo ...
- UIKit框架
在今后的应用程序构建中,会陆续使用各式各样的控件,因此UIKit框架的引入是必不可少的! 一.简介 UIKitk框架提供一系列的Class(类)来建立和管理iPhone OS应用程序的用户界面接口.应 ...
- iOS学习32之UIKit框架-可视化编程-XIB
1. Interface Builder 可视化编程 1> 概述 GUI : 图形用户界面(Graphical User Interface, 简称GUI, 又称图形化界面) 是指采用图形方式显 ...
- 基础框架Fundation和UIkit框架的定义和使用
Foundation 框架为所有应用程序提供基本的系统服务 您的应用程序以及 UIKit 和其他框架,都建立在 Foundation 框架的基础结构之上.Foundation 框架提供许多基本的对象类 ...
- iOS开发概述UIkit动力学,讲述UIKit的Dynamic特性,UIkit动力学是UIkit框架中模拟真实世界的一些特性。
转发:http://my.oschina.net/u/1378445/blog/335014 iOS UIKit动力学 Dynamics UIAttachmentBehavior 实现iMessage ...
- iOS开发UIKit框架-可视化编程-XIB
1. Interface Builder 可视化编程 1> 概述 GUI : 图形用户界面(Graphical User Interface, 简称GUI, 又称图形化界面) 是指采用图形方式显 ...
- 79、iOS 的Cocoa框架、Foundation框架以及UIKit框架
Cocoa框架是iOS应用程序的基础 1. Cocoa是什么? Cocoa是 OS X和ios 操作系统的程序的运行环境. 是什么因素使一个程序成为Cocoa程序呢?不是编程语言,因为在Cocoa开发 ...
- UIKit 框架之UIView二
下面这些都是UIView一些基本的东西,具体的可以参考UIKit 框架之UIView一博客 一.自定义一个View // // MyView.m // UIView // // Created by ...
- UIKit 框架之Bar、Controller
UIKit框架中有各种Bar,UITabBar.UINavigationBar.UIToolbar.Bar对应的就有一些Item,tabBarItem.navigationItem.toolbarIt ...
随机推荐
- css学习笔记 9
两列定宽和两列宽度自适应结构: 在ie7及以下,container的宽度和两列子元素的宽度设置为具体值或百分比的任意组合时,两列子元素即使浮动,container的高度也能自适应:其他浏览器需要为co ...
- cf#382div2
A. 题意:字符串长度n,每次可向左向右跳k个格子.要求不能在障碍物处停留('#'),可以在空地处停留(' . ').给出字符串,从G开始,问能不能到达T. 分析:直接从G处开始向两边搜,如果能到T则 ...
- C# 中正确实现 IDisposable 接口
作用 此接口的主要用途是释放非托管资源. 当不再使用托管对象时,垃圾回收器会自动释放分配给该对象的内存. 但无法预测进行垃圾回收的时间. 另外,垃圾回收器对窗口句柄或打开的文件和流等非托管资源一无所知 ...
- hdu1754 I Hate It
题目链接:hdu1754 I Hate It 树状数组学习参考博客:http://blog.csdn.net/u010598215/article/details/48206959 树状数组之前没看懂 ...
- Discuz中解决jquery 冲突的方法 绝对简单
将jquery.js在common.js之前载入,不然jquery的$()函数会覆盖common.js的$()函数: 然后用到jQuery的$()函数的地方都用jQuery()代替. 例如 $(doc ...
- 关于MySql has gone away问题的解决
everybody 是否导入数据库的时候 导的导的 就会出现这个错误呢,这个错误的原因是你的数据库有点大,数据有点多,导入时间过长与服务器失去连接了,让我们看下咋解决把. 如果用的是xampp 修改m ...
- PHP 中:: -> self $this 操作符的区别
访问PHP类中的成员变量或方法时, 如果被引用的变量或者方法被声明成const(定义常量)或者static(声明静态),那么就必须使用操作符::, 反之如果被引用的变量或者方法没有被声明成 const ...
- OC — (Foundation框架-NSDate)
NSDate:是OC中处理日期时间的一个类,可以用来表示时间 获取当前的时间 NSDate *d = [NSDate date]; 创建日期时间对象 NSLog输出是当前时间 格林时间 格式化显示时间 ...
- sql2008r2数据库附加的问题
sql2008r2数据库附加,一般都没有问题,但是偶尔也会出错,无法附加,一般的原因都是权限不够,主要是:Authenticated Users要开通完全控制功能,选中该用户(如果没有该用户,就添加) ...
- Sql 获取向上取整、向下取整、四舍五入取整的实例
[四舍五入取整截取] select round(54.56,0) [向下取整截取] SELECT FLOOR(54.56) [向上取整截取] SELECT CEILING(13.15) --MS ...