• Cocoa touch(二):UIApplication


    UIApplication,用于应用程序级别的管理,实例是由系统自动创建的,通过类方法sharedApplication获取UIApplication实例。

    typedef NS_ENUM(NSInteger, UIStatusBarStyle) {
        UIStatusBarStyleDefault,
        UIStatusBarStyleBlackTranslucent,
        UIStatusBarStyleBlackOpaque
    };
    
    typedef NS_ENUM(NSInteger, UIStatusBarAnimation) {
        UIStatusBarAnimationNone,
        UIStatusBarAnimationFade,
        UIStatusBarAnimationSlide,
    
    };
    
    // Note that UIInterfaceOrientationLandscapeLeft is equal to UIDeviceOrientationLandscapeRight (and vice versa).
    // This is because rotating the device to the left requires rotating the content to the right.
    typedef NS_ENUM(NSInteger, UIInterfaceOrientation) {
        UIInterfaceOrientationPortrait           = UIDeviceOrientationPortrait,
        UIInterfaceOrientationPortraitUpsideDown = UIDeviceOrientationPortraitUpsideDown,
        UIInterfaceOrientationLandscapeLeft      = UIDeviceOrientationLandscapeRight,
        UIInterfaceOrientationLandscapeRight     = UIDeviceOrientationLandscapeLeft
    };
    
    /* This exception is raised if supportedInterfaceOrientations returns 0, or if preferredInterfaceOrientationForPresentation
       returns an orientation that is not supported.
    */
    UIKIT_EXTERN NSString *const UIApplicationInvalidInterfaceOrientationException NS_AVAILABLE_IOS(6_0);
    
    typedef NS_OPTIONS(NSUInteger, UIInterfaceOrientationMask) {
        UIInterfaceOrientationMaskPortrait = (1 << UIInterfaceOrientationPortrait),
        UIInterfaceOrientationMaskLandscapeLeft = (1 << UIInterfaceOrientationLandscapeLeft),
        UIInterfaceOrientationMaskLandscapeRight = (1 << UIInterfaceOrientationLandscapeRight),
        UIInterfaceOrientationMaskPortraitUpsideDown = (1 << UIInterfaceOrientationPortraitUpsideDown),
        UIInterfaceOrientationMaskLandscape = (UIInterfaceOrientationMaskLandscapeLeft | UIInterfaceOrientationMaskLandscapeRight),
        UIInterfaceOrientationMaskAll = (UIInterfaceOrientationMaskPortrait | UIInterfaceOrientationMaskLandscapeLeft | UIInterfaceOrientationMaskLandscapeRight | UIInterfaceOrientationMaskPortraitUpsideDown),
        UIInterfaceOrientationMaskAllButUpsideDown = (UIInterfaceOrientationMaskPortrait | UIInterfaceOrientationMaskLandscapeLeft | UIInterfaceOrientationMaskLandscapeRight),
    };
    
    #define UIDeviceOrientationIsValidInterfaceOrientation(orientation) ((orientation) == UIDeviceOrientationPortrait || (orientation) == UIDeviceOrientationPortraitUpsideDown || (orientation) == UIDeviceOrientationLandscapeLeft || (orientation) == UIDeviceOrientationLandscapeRight)
    #define UIInterfaceOrientationIsPortrait(orientation)  ((orientation) == UIInterfaceOrientationPortrait || (orientation) == UIInterfaceOrientationPortraitUpsideDown)
    #define UIInterfaceOrientationIsLandscape(orientation) ((orientation) == UIInterfaceOrientationLandscapeLeft || (orientation) == UIInterfaceOrientationLandscapeRight)
    
    typedef NS_OPTIONS(NSUInteger, UIRemoteNotificationType) {
        UIRemoteNotificationTypeNone    = 0,
        UIRemoteNotificationTypeBadge   = 1 << 0,
        UIRemoteNotificationTypeSound   = 1 << 1,
        UIRemoteNotificationTypeAlert   = 1 << 2,
        UIRemoteNotificationTypeNewsstandContentAvailability = 1 << 3,
    } NS_ENUM_AVAILABLE_IOS(3_0);
    
    typedef NS_ENUM(NSInteger, UIApplicationState) {
        UIApplicationStateActive,
        UIApplicationStateInactive,
        UIApplicationStateBackground
    } NS_ENUM_AVAILABLE_IOS(4_0);
    
    typedef NSUInteger UIBackgroundTaskIdentifier;
    UIKIT_EXTERN const UIBackgroundTaskIdentifier UIBackgroundTaskInvalid  NS_AVAILABLE_IOS(4_0);
    UIKIT_EXTERN const NSTimeInterval UIMinimumKeepAliveTimeout  NS_AVAILABLE_IOS(4_0);
    
    typedef NS_ENUM(NSInteger, UIUserInterfaceLayoutDirection) {
        UIUserInterfaceLayoutDirectionLeftToRight,
        UIUserInterfaceLayoutDirectionRightToLeft,
    } NS_ENUM_AVAILABLE_IOS(5_0);
    
    @class UIView, UIWindow, UIStatusBar, UIStatusBarWindow, UILocalNotification;
    @protocol UIApplicationDelegate;
    
    @interface UIApplication : UIResponder <UIActionSheetDelegate>+ (UIApplication *)sharedApplication;
    
    @property(nonatomic,assign) id<UIApplicationDelegate> delegate;
    
    - (void)beginIgnoringInteractionEvents;               // nested. set should be set during animations & transitions to ignore touch and other events
    - (void)endIgnoringInteractionEvents;
    - (BOOL)isIgnoringInteractionEvents;                  // returns YES if we are at least one deep in ignoring events
    
    @property(nonatomic,getter=isIdleTimerDisabled)       BOOL idleTimerDisabled;      // default is NO
    
    - (BOOL)openURL:(NSURL*)url;
    - (BOOL)canOpenURL:(NSURL *)url NS_AVAILABLE_IOS(3_0);
    
    - (void)sendEvent:(UIEvent *)event;
    
    @property(nonatomic,readonly) UIWindow *keyWindow;
    @property(nonatomic,readonly) NSArray  *windows;
    
    - (BOOL)sendAction:(SEL)action to:(id)target from:(id)sender forEvent:(UIEvent *)event;
    
    @property(nonatomic,getter=isNetworkActivityIndicatorVisible) BOOL networkActivityIndicatorVisible; // showing network spinning gear in status bar. default is NO
    
    @property(nonatomic) UIStatusBarStyle statusBarStyle; // default is UIStatusBarStyleDefault
    - (void)setStatusBarStyle:(UIStatusBarStyle)statusBarStyle animated:(BOOL)animated;
    
    @property(nonatomic,getter=isStatusBarHidden) BOOL statusBarHidden;
    - (void)setStatusBarHidden:(BOOL)hidden withAnimation:(UIStatusBarAnimation)animation NS_AVAILABLE_IOS(3_2);
    
    // Rotate to a specific orientation.  This only rotates the status bar and updates the statusBarOrientation property.
    // This does not change automatically if the device changes orientation.
    // Explicit setting of the status bar orientation is more limited in iOS 6.0 and later.
    @property(nonatomic) UIInterfaceOrientation statusBarOrientation;
    - (void)setStatusBarOrientation:(UIInterfaceOrientation)interfaceOrientation animated:(BOOL)animated;
    
    // The system only calls this method if the application delegate has not
    // implemented the delegate equivalent. It returns the orientations specified by
    // the application's info.plist. If no supported interface orientations were
    // specified it will return UIInterfaceOrientationMaskAll on an iPad and
    // UIInterfaceOrientationMaskAllButUpsideDown on a phone.  The return value
    // should be one of the UIInterfaceOrientationMask values which indicates the
    // orientations supported by this application.
    - (NSUInteger)supportedInterfaceOrientationsForWindow:(UIWindow *)window NS_AVAILABLE_IOS(6_0);
    
    @property(nonatomic,readonly) NSTimeInterval statusBarOrientationAnimationDuration; // Returns the animation duration for the status bar during a 90 degree orientation change.  It should be doubled for a 180 degree orientation change.
    @property(nonatomic,readonly) CGRect statusBarFrame; // returns CGRectZero if the status bar is hidden
    
    @property(nonatomic) NSInteger applicationIconBadgeNumber;  // set to 0 to hide. default is 0
    
    @property(nonatomic) BOOL applicationSupportsShakeToEdit NS_AVAILABLE_IOS(3_0);
    
    @property(nonatomic,readonly) UIApplicationState applicationState NS_AVAILABLE_IOS(4_0);
    @property(nonatomic,readonly) NSTimeInterval backgroundTimeRemaining NS_AVAILABLE_IOS(4_0);
    
    - (UIBackgroundTaskIdentifier)beginBackgroundTaskWithExpirationHandler:(void(^)(void))handler  NS_AVAILABLE_IOS(4_0);
    - (void)endBackgroundTask:(UIBackgroundTaskIdentifier)identifier NS_AVAILABLE_IOS(4_0);
    
    - (BOOL)setKeepAliveTimeout:(NSTimeInterval)timeout handler:(void(^)(void))keepAliveHandler NS_AVAILABLE_IOS(4_0);
    - (void)clearKeepAliveTimeout NS_AVAILABLE_IOS(4_0);
    
    @property(nonatomic,readonly,getter=isProtectedDataAvailable) BOOL protectedDataAvailable NS_AVAILABLE_IOS(4_0);
    
    @property(nonatomic,readonly) UIUserInterfaceLayoutDirection userInterfaceLayoutDirection NS_AVAILABLE_IOS(5_0);
    
    @end
    
    @interface UIApplication (UIRemoteNotifications)
    
    - (void)registerForRemoteNotificationTypes:(UIRemoteNotificationType)types NS_AVAILABLE_IOS(3_0);
    - (void)unregisterForRemoteNotifications NS_AVAILABLE_IOS(3_0);       // calls -registerForRemoteNotificationTypes with UIRemoteNotificationTypeNone
    
    // returns the enabled types, also taking into account any systemwide settings; doesn't relate to connectivity
    - (UIRemoteNotificationType)enabledRemoteNotificationTypes NS_AVAILABLE_IOS(3_0);
    
    @end
    
    @interface UIApplication (UILocalNotifications)
    
    - (void)presentLocalNotificationNow:(UILocalNotification *)notification NS_AVAILABLE_IOS(4_0);
    
    - (void)scheduleLocalNotification:(UILocalNotification *)notification NS_AVAILABLE_IOS(4_0);  // copies notification
    - (void)cancelLocalNotification:(UILocalNotification *)notification NS_AVAILABLE_IOS(4_0);
    - (void)cancelAllLocalNotifications NS_AVAILABLE_IOS(4_0);
    @property(nonatomic,copy) NSArray *scheduledLocalNotifications NS_AVAILABLE_IOS(4_0);         // setter added in iOS 4.2
    
    @end
    
    @interface UIApplication (UIRemoteControlEvents)
    
    - (void)beginReceivingRemoteControlEvents NS_AVAILABLE_IOS(4_0);
    - (void)endReceivingRemoteControlEvents NS_AVAILABLE_IOS(4_0);
    
    @end
    
    @interface UIApplication (UINewsstand)
    - (void)setNewsstandIconImage:(UIImage *)image;
    @end
    
    @interface UIApplication (UIStateRestoration)
    // These methods are used to inform the system that state restoration is occuring asynchronously after the application
    // has processed its restoration archive on launch. In the even of a crash, the system will be able to detect that it may
    // have been caused by a bad restoration archive and arrange to ignore it on a subsequent application launch.
    - (void)extendStateRestoration  NS_AVAILABLE_IOS(6_0);
    - (void)completeStateRestoration  NS_AVAILABLE_IOS(6_0);
    @end

    UIApplicationDelegate,用于处理应用程序生命周期中各事件的。我们的应用程序中都会实现这个协议

    @protocol UIApplicationDelegate<NSObject>
    
    @optional
    // 看事件处理委托的名字,基本可以理解其意义
    - (void)applicationDidFinishLaunching:(UIApplication *)application; 
    - (BOOL)application:(UIApplication *)application willFinishLaunchingWithOptions:(NSDictionary *)launchOptions NS_AVAILABLE_IOS(6_0);
    - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions NS_AVAILABLE_IOS(3_0);
    
    - (void)applicationDidBecomeActive:(UIApplication *)application;
    - (void)applicationWillResignActive:(UIApplication *)application;
    - (BOOL)application:(UIApplication *)application handleOpenURL:(NSURL *)url;  // Will be deprecated at some point, please replace with application:openURL:sourceApplication:annotation:
    - (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation NS_AVAILABLE_IOS(4_2); // no equiv. notification. return NO if the application can't open for some reason
    
    - (void)applicationDidReceiveMemoryWarning:(UIApplication *)application;      // try to clean up as much memory as possible. next step is to terminate app
    - (void)applicationWillTerminate:(UIApplication *)application;
    - (void)applicationSignificantTimeChange:(UIApplication *)application;        // midnight, carrier time update, daylight savings time change
    
    - (void)application:(UIApplication *)application willChangeStatusBarOrientation:(UIInterfaceOrientation)newStatusBarOrientation duration:(NSTimeInterval)duration;
    - (void)application:(UIApplication *)application didChangeStatusBarOrientation:(UIInterfaceOrientation)oldStatusBarOrientation;
    
    - (void)application:(UIApplication *)application willChangeStatusBarFrame:(CGRect)newStatusBarFrame;   // in screen coordinates
    - (void)application:(UIApplication *)application didChangeStatusBarFrame:(CGRect)oldStatusBarFrame;
    
    // one of these will be called after calling -registerForRemoteNotifications
    - (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken NS_AVAILABLE_IOS(3_0);
    - (void)application:(UIApplication *)application didFailToRegisterForRemoteNotificationsWithError:(NSError *)error NS_AVAILABLE_IOS(3_0);
    
    - (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo NS_AVAILABLE_IOS(3_0);
    - (void)application:(UIApplication *)application didReceiveLocalNotification:(UILocalNotification *)notification NS_AVAILABLE_IOS(4_0);
    
    - (void)applicationDidEnterBackground:(UIApplication *)application NS_AVAILABLE_IOS(4_0);
    - (void)applicationWillEnterForeground:(UIApplication *)application NS_AVAILABLE_IOS(4_0);
    
    - (void)applicationProtectedDataWillBecomeUnavailable:(UIApplication *)application NS_AVAILABLE_IOS(4_0);
    - (void)applicationProtectedDataDidBecomeAvailable:(UIApplication *)application    NS_AVAILABLE_IOS(4_0);
    
    @property (nonatomic, retain) UIWindow *window NS_AVAILABLE_IOS(5_0);
    
    - (NSUInteger)application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window  NS_AVAILABLE_IOS(6_0);
    
    #pragma mark -- State Restoration protocol adopted by UIApplication delegate --
    
    - (UIViewController *) application:(UIApplication *)application viewControllerWithRestorationIdentifierPath:(NSArray *)identifierComponents coder:(NSCoder *)coder NS_AVAILABLE_IOS(6_0);
    - (BOOL) application:(UIApplication *)application shouldSaveApplicationState:(NSCoder *)coder NS_AVAILABLE_IOS(6_0);
    - (BOOL) application:(UIApplication *)application shouldRestoreApplicationState:(NSCoder *)coder NS_AVAILABLE_IOS(6_0);
    - (void) application:(UIApplication *)application willEncodeRestorableStateWithCoder:(NSCoder *)coder NS_AVAILABLE_IOS(6_0);
    - (void) application:(UIApplication *)application didDecodeRestorableStateWithCoder:(NSCoder *)coder NS_AVAILABLE_IOS(6_0);
    @end
    
    @interface UIApplication(UIApplicationDeprecated)
    
    @property(nonatomic,getter=isProximitySensingEnabled) BOOL proximitySensingEnabled NS_DEPRECATED_IOS(2_0, 3_0); // default is NO. see UIDevice for replacement
    - (void)setStatusBarHidden:(BOOL)hidden animated:(BOOL)animated NS_DEPRECATED_IOS(2_0, 3_2); // use -setStatusBarHidden:withAnimation:
    
    @end
    
    // If nil is specified for principalClassName, the value for NSPrincipalClass from the Info.plist is used. If there is no
    // NSPrincipalClass key specified, the UIApplication class is used. The delegate class will be instantiated using init.
    UIKIT_EXTERN int UIApplicationMain(int argc, char *argv[], NSString *principalClassName, NSString *delegateClassName);
    
    UIKIT_EXTERN NSString *const UITrackingRunLoopMode;
    
    // These notifications are sent out after the equivalent delegate message is called
    UIKIT_EXTERN NSString *const UIApplicationDidEnterBackgroundNotification       NS_AVAILABLE_IOS(4_0);
    UIKIT_EXTERN NSString *const UIApplicationWillEnterForegroundNotification      NS_AVAILABLE_IOS(4_0);
    UIKIT_EXTERN NSString *const UIApplicationDidFinishLaunchingNotification;
    UIKIT_EXTERN NSString *const UIApplicationDidBecomeActiveNotification;
    UIKIT_EXTERN NSString *const UIApplicationWillResignActiveNotification;
    UIKIT_EXTERN NSString *const UIApplicationDidReceiveMemoryWarningNotification;
    UIKIT_EXTERN NSString *const UIApplicationWillTerminateNotification;
    UIKIT_EXTERN NSString *const UIApplicationSignificantTimeChangeNotification;
    UIKIT_EXTERN NSString *const UIApplicationWillChangeStatusBarOrientationNotification; // userInfo contains NSNumber with new orientation
    UIKIT_EXTERN NSString *const UIApplicationDidChangeStatusBarOrientationNotification;  // userInfo contains NSNumber with old orientation
    UIKIT_EXTERN NSString *const UIApplicationStatusBarOrientationUserInfoKey;            // userInfo dictionary key for status bar orientation
    UIKIT_EXTERN NSString *const UIApplicationWillChangeStatusBarFrameNotification;       // userInfo contains NSValue with new frame
    UIKIT_EXTERN NSString *const UIApplicationDidChangeStatusBarFrameNotification;        // userInfo contains NSValue with old frame
    UIKIT_EXTERN NSString *const UIApplicationStatusBarFrameUserInfoKey;                  // userInfo dictionary key for status bar frame
    UIKIT_EXTERN NSString *const UIApplicationLaunchOptionsURLKey                NS_AVAILABLE_IOS(3_0); // userInfo contains NSURL with launch URL
    UIKIT_EXTERN NSString *const UIApplicationLaunchOptionsSourceApplicationKey  NS_AVAILABLE_IOS(3_0); // userInfo contains NSString with launch app bundle ID
    UIKIT_EXTERN NSString *const UIApplicationLaunchOptionsRemoteNotificationKey NS_AVAILABLE_IOS(3_0); // userInfo contains NSDictionary with payload
    UIKIT_EXTERN NSString *const UIApplicationLaunchOptionsLocalNotificationKey  NS_AVAILABLE_IOS(4_0); // userInfo contains a UILocalNotification
    UIKIT_EXTERN NSString *const UIApplicationLaunchOptionsAnnotationKey         NS_AVAILABLE_IOS(3_2); // userInfo contains object with annotation property list
    UIKIT_EXTERN NSString *const UIApplicationProtectedDataWillBecomeUnavailable NS_AVAILABLE_IOS(4_0);
    UIKIT_EXTERN NSString *const UIApplicationProtectedDataDidBecomeAvailable    NS_AVAILABLE_IOS(4_0);
    UIKIT_EXTERN NSString *const UIApplicationLaunchOptionsLocationKey           NS_AVAILABLE_IOS(4_0); // app was launched in response to a CoreLocation event.
    UIKIT_EXTERN NSString *const UIApplicationLaunchOptionsNewsstandDownloadsKey NS_AVAILABLE_IOS(5_0); // userInfo contains an NSArray of NKAssetDownload identifiers

    UIWindows,每个应用程序只有一个窗口,需要我们在程序启动时创建。

    @interface UIWindow : UIView
     
    @property(nonatomic,retain) UIScreen *screen NS_AVAILABLE_IOS(3_2);  // default is [UIScreen mainScreen]. changing the screen may be an expensive operation and should not be done in performance-sensitive code
    
    @property(nonatomic) UIWindowLevel windowLevel;                   // default = 0.0
    @property(nonatomic,readonly,getter=isKeyWindow) BOOL keyWindow;
    - (void)becomeKeyWindow;                               // override point for subclass. Do not call directly
    - (void)resignKeyWindow;                               // override point for subclass. Do not call directly
    
    - (void)makeKeyWindow;
    - (void)makeKeyAndVisible;                             // convenience. most apps call this to show the main window and also make it key. otherwise use view hidden property
    
    @property(nonatomic,retain) UIViewController *rootViewController NS_AVAILABLE_IOS(4_0);  // default is nil
    
    - (void)sendEvent:(UIEvent *)event;                    // called by UIApplication to dispatch events to views inside the window
    
    - (CGPoint)convertPoint:(CGPoint)point toWindow:(UIWindow *)window;    // can be used to convert to another window
    - (CGPoint)convertPoint:(CGPoint)point fromWindow:(UIWindow *)window;  // pass in nil to mean screen
    - (CGRect)convertRect:(CGRect)rect toWindow:(UIWindow *)window;
    - (CGRect)convertRect:(CGRect)rect fromWindow:(UIWindow *)window;
    
    @end
    
    UIKIT_EXTERN const UIWindowLevel UIWindowLevelNormal;
    UIKIT_EXTERN const UIWindowLevel UIWindowLevelAlert;
    UIKIT_EXTERN const UIWindowLevel UIWindowLevelStatusBar;
    
    UIKIT_EXTERN NSString *const UIWindowDidBecomeVisibleNotification; // nil
    UIKIT_EXTERN NSString *const UIWindowDidBecomeHiddenNotification;  // nil
    UIKIT_EXTERN NSString *const UIWindowDidBecomeKeyNotification;     // nil
    UIKIT_EXTERN NSString *const UIWindowDidResignKeyNotification;     // nil
    
    // Each notification includes a nil object and a userInfo dictionary containing the
    // begining and ending keyboard frame in screen coordinates. Use the various UIView and
    // UIWindow convertRect facilities to get the frame in the desired coordinate system.
    // Animation key/value pairs are only available for the "will" family of notification.
    UIKIT_EXTERN NSString *const UIKeyboardWillShowNotification;
    UIKIT_EXTERN NSString *const UIKeyboardDidShowNotification; 
    UIKIT_EXTERN NSString *const UIKeyboardWillHideNotification; 
    UIKIT_EXTERN NSString *const UIKeyboardDidHideNotification;
    
    UIKIT_EXTERN NSString *const UIKeyboardFrameBeginUserInfoKey        NS_AVAILABLE_IOS(3_2); // NSValue of CGRect
    UIKIT_EXTERN NSString *const UIKeyboardFrameEndUserInfoKey          NS_AVAILABLE_IOS(3_2); // NSValue of CGRect
    UIKIT_EXTERN NSString *const UIKeyboardAnimationDurationUserInfoKey NS_AVAILABLE_IOS(3_0); // NSNumber of double
    UIKIT_EXTERN NSString *const UIKeyboardAnimationCurveUserInfoKey    NS_AVAILABLE_IOS(3_0); // NSNumber of NSUInteger (UIViewAnimationCurve)
    
    // Like the standard keyboard notifications above, these additional notifications include
    // a nil object and begin/end frames of the keyboard in screen coordinates in the userInfo dictionary.
    UIKIT_EXTERN NSString *const UIKeyboardWillChangeFrameNotification  NS_AVAILABLE_IOS(5_0);
    UIKIT_EXTERN NSString *const UIKeyboardDidChangeFrameNotification   NS_AVAILABLE_IOS(5_0);
    
    // These keys are superseded by UIKeyboardFrameBeginUserInfoKey and UIKeyboardFrameEndUserInfoKey.
    UIKIT_EXTERN NSString *const UIKeyboardCenterBeginUserInfoKey   NS_DEPRECATED_IOS(2_0, 3_2);
    UIKIT_EXTERN NSString *const UIKeyboardCenterEndUserInfoKey     NS_DEPRECATED_IOS(2_0, 3_2);
    UIKIT_EXTERN NSString *const UIKeyboardBoundsUserInfoKey        NS_DEPRECATED_IOS(2_0, 3_2);

    UIScreen 常用的方法

    // 取得屏幕大小
    CGRect *rect = [[UIScreen mainScreen] bounds];
    NS_CLASS_AVAILABLE_IOS(2_0) @interface UIScreen : NSObject {
    + (NSArray *)screens NS_AVAILABLE_IOS(3_2);          // all screens currently attached to the device
    + (UIScreen *)mainScreen;      // the device's internal screen
    
    @property(nonatomic,readonly) CGRect  bounds;                // Bounds of entire screen in points
    @property(nonatomic,readonly) CGRect  applicationFrame;      // Frame of application screen area in points (i.e. entire screen minus status bar if visible)
    @property(nonatomic,readonly) CGFloat scale NS_AVAILABLE_IOS(4_0);
    
    @property(nonatomic,readonly,copy) NSArray *availableModes NS_AVAILABLE_IOS(3_2);             // The list of modes that this screen supports
    @property(nonatomic,readonly,retain) UIScreenMode *preferredMode NS_AVAILABLE_IOS(4_3);       // Preferred mode of this screen. Choosing this mode will likely produce the best results
    @property(nonatomic,retain) UIScreenMode *currentMode NS_AVAILABLE_IOS(3_2);                  // Current mode of this screen
    @property(nonatomic) UIScreenOverscanCompensation overscanCompensation NS_AVAILABLE_IOS(5_0); // Default is UIScreenOverscanCompensationScale. Determines how the screen behaves if the connected display is overscanning
    
    @property(nonatomic,readonly,retain) UIScreen *mirroredScreen NS_AVAILABLE_IOS(4_3);          // The screen being mirrored by the receiver. nil if mirroring is disabled or unsupported. Moving a UIWindow to this screen will disable mirroring
    
    @property(nonatomic) CGFloat brightness NS_AVAILABLE_IOS(5_0);        // 0 .. 1.0, where 1.0 is maximum brightness. Only supported by main screen.
    @property(nonatomic) BOOL wantsSoftwareDimming NS_AVAILABLE_IOS(5_0); // Default is NO. If YES, brightness levels lower than that of which the hardware is capable are emulated in software, if neccessary. Having enabled may entail performance cost.
    
    - (CADisplayLink *)displayLinkWithTarget:(id)target selector:(SEL)sel NS_AVAILABLE_IOS(4_0);
    
    @end
  • 相关阅读:
    0x01 虚拟环境搭建
    python操作mysql8windows环境
    Navicat 导入sql文件执行失败问题的处理
    mysql8.0.16免安装教程
    zend studio 9.0.3 注册码
    oneplus8手机蓝牙连接tws耳机无法双击退出语音助手
    竞品分析
    源码阅读方法
    Tomcat内核1
    Asp.NetCore3.1开源项目升级为.Net6.0
  • 原文地址:https://www.cnblogs.com/iprogrammer/p/3252455.html
Copyright © 2020-2023  润新知