• UIkit框架之uiUIapplication


    1.继承链:uiresponder:NSObject

    2.使用 sharedApplication方法来存取对象

    3.这个类可以遵守协议是UIApplicationDelegate

    4.获取app的实例

        (1)+ (UIApplication *)sharedApplication  :返回单个app实例

    5.获取app委托

        (1)@property(nonatomicassignidUIApplicationDelegate delegate  :设置委托

    6.获取app窗口

        (1)@property(nonatomicreadonlyUIWindow *keyWindow  :app的关键窗口

        (2)@property(nonatomicreadonlyNSArray <__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 target is nil, the app sends the message to the first responder, from whence it progresses up the responder chain until it is handled.

    sender

    The object that is sending the action message. The default sender is the UIControl object that invokes this method.

    event

    UIEvent object that encapsulates information about the event originating the action message.

        (3)- (void)beginIgnoringInteractionEvents  :开始动画和转换之前调用这个方法通知接收者延迟处理和触摸相关的事件

        (4)- (void)endIgnoringInteractionEvents  :调用上面的方法、动画或者转换之后调用这个方法通知接收者重新处理和触摸相关的事件

        (5)- (BOOL)isIgnoringInteractionEvents  :返回布尔值是否让接收者忽视由屏幕上出现的触摸事件

        (6)@property(nonatomicBOOL 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(nonatomiccopyNSArray <UILocalNotification *> *scheduledLocalNotifications  :所有当前时间表的本地通知

    12.管理后台执行

        (1)@property(nonatomicreadonlyUIApplicationState applicationState  :app运行时的状态

        (2)@property(nonatomicreadonlyNSTimeInterval backgroundTimeRemaining  :app在后台运行的时间

        (3)@property(nonatomicreadonlyUIBackgroundRefreshStatus backgroundRefreshStatus  :有能力在后台执行的程序

        (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(nonatomicgetter=isIdleTimerDisabledBOOL 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(nonatomiccopyNSArray <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(nonatomicreadonlygetter=isProtectedDataAvailableBOOL protectedDataAvailable  :返回值确定内容是否是被保护的

    17.注册远程控制事件

        (1)- (void)beginReceivingRemoteControlEvents  :告诉app开始接受远程控制事件

        (2)- (void)endReceivingRemoteControlEvents  :告诉app结束接受远程控制事件

    18.控制app的显示

        (1)@property(nonatomicreadonlyCGRect statusBarFrame  :读取状态栏的位置和大小

        (2)@property(nonatomicgetter=isNetworkActivityIndicatorVisibleBOOL networkActivityIndicatorVisible  :网络是否能够使用

        (3)@property(nonatomicNSInteger applicationIconBadgeNumber  :The number currently set as the badge of the app icon in Springboard.  

        (4)@property(nonatomicreadonlyUIUserInterfaceLayoutDirection userInterfaceLayoutDirection  :返回用户界面的布局方向

    18.获取字体大小偏好

        (1)@property(nonatomicreadonlyNSString *preferredContentSizeCategory  :用户更加喜欢的字体大小选择

    19.管理默认的界面方向

        (1)- (UIInterfaceOrientationMask)supportedInterfaceOrientationsForWindow:(UIWindow *)window  :返回指定窗口支持的界面方向

    20.管理状态栏的方向

        (1)@property(nonatomicreadonlyNSTimeInterval statusBarOrientationAnimationDuration  :当设备90度转变的时候状态栏的动画转换

    21.数据类型

        (1)UIStatusBarStyle类型

    UIStatusBarStyleDefault,  :黑色的状态栏

    UIStatusBarStyleLightContent,  :光亮的状态栏

    UIStatusBarStyleBlackTranslucent,  :黑色透明的状态栏

    UIStatusBarStyleBlackOpaque  :黑色不透明的状态栏

        (2)UIStatusBarAnimation类型

    UIStatusBarAnimationNone,  :状态栏显示和隐藏的时候没有动画

    UIStatusBarAnimationFade,  :状态栏显示和隐藏的时候使用渐隐渐现的动画

    UIStatusBarAnimationSlide,  :状态栏显示和隐藏的时候使用滑动的动画

    22.常量
        (1)UIApplicationState常量
    UIApplicationStateActive,  :app正在前端运行并且接受事件
    UIApplicationStateInactive,  :app正在前端运行但不接受事件
    UIApplicationStateBackground    :app正在后台运行
        (2)Background Task Constants常量
    const UIBackgroundTaskIdentifier UIBackgroundTaskInvalid;  :这个常量应该用来初始化一个常量或者检查一个错误
    const NSTimeInterval UIMinimumKeepAliveTimeout;  :app应该在后台运行的时间

        (3)UIBackgroundFetchResult常量

    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  :当用户改变设定的内容大小的时候就会发送这个通知

     
       
  • 相关阅读:
    php 闭包 function use用法
    php序列号和反序列化
    [转]php composer使用
    hex编码,用途是什么,为什么需要hex编码呢?
    美术资源优化/LOD
    ASTC纹理压缩格式详解
    Elastic Stack之 Elasticsearch 6.7.1版本单机版安装、集群版安装
    使用datax将mysql数据同步到ES 附elasticsearchwriter插件
    Java1.8之Lambda表达式
    Java1.8之Lambda表达式、流Stream学习
  • 原文地址:https://www.cnblogs.com/lelun/p/5727676.html
Copyright © 2020-2023  润新知