【Xcode 7.3】UIWindow.h - UIKit

本文并非最终版本,如果想要关注更新或更正的内容请关注文集,联系方式详见文末,如有疏忽和遗漏,欢迎指正。


本文相关目录:
【Xcode 7.3】UIWindow.h - UIKit
1.0 UIWindow ->1.0 NSWindow - 窗口
1.0 UIWindow ->2.0 UIWindow简介和创建过程

声明:本文在官方原版头文件的基础上加上了中文注释,个别地方还没有标注


//  Copyright (c) 2005-2015 Apple Inc. All rights reserved.
#import 
#import 
#import 
#import 
#import 
NS_ASSUME_NONNULL_BEGINtypedef CGFloat UIWindowLevel;
@class UIEvent, UIScreen, NSUndoManager, UIViewController;
NS_CLASS_AVAILABLE_IOS(2_0)
@interface UIWindow : UIView

// 默认是[UIScreen mainScreen]。修改屏幕的操作代价非常大
// default is [UIScreen mainScreen]. changing the screen may be an expensive operation and should not be done in performance-sensitive code
@property(nonatomic,strong) UIScreen *screen   NS_AVAILABLE_IOS(3_2);

// default = 0.0,窗口级别越高,显示越靠前
@property(nonatomic) UIWindowLevel windowLevel;

// 是否是主窗口
@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;// 简化方法,让窗口成为主窗口并且可见,如果要不可见,可以使用view的hidden属性 convenience. most apps call this to show the main window and also make it key. otherwise use view hidden property

// 根视图控制器,默认为nil
@property(nullable, nonatomic,strong) UIViewController *rootViewController    NS_AVAILABLE_IOS(4_0); 

// 由UIApplication调用向窗口中的子视图派发事件 called by UIApplication to dispatch events to views inside the window
- (void)sendEvent:(UIEvent *)event; 

// 转换坐标系 can be used to convert to another window
- (CGPoint)convertPoint:(CGPoint)point toWindow:(nullable UIWindow *)window; 
// 传入nil,表示主屏幕 pass in nil to mean screen  
- (CGPoint)convertPoint:(CGPoint)point fromWindow:(nullable UIWindow *)window; 
- (CGRect)convertRect:(CGRect)rect toWindow:(nullable UIWindow *)window;
- (CGRect)convertRect:(CGRect)rect fromWindow:(nullable UIWindow *)window;

@end
UIKIT_EXTERN const UIWindowLevel UIWindowLevelNormal;
UIKIT_EXTERN const UIWindowLevel UIWindowLevelAlert;
UIKIT_EXTERN const UIWindowLevel UIWindowLevelStatusBar __TVOS_PROHIBITED;

UIKIT_EXTERN NSString *const UIWindowDidBecomeVisibleNotification; // nilUIKIT_EXTERN NSString *const UIWindowDidBecomeHiddenNotification;  // nilUIKIT_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)
UIKIT_EXTERN NSString *const UIKeyboardIsLocalUserInfoKey           NS_AVAILABLE_IOS(9_0); // NSNumber of BOOL


// 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) __TVOS_PROHIBITED;
UIKIT_EXTERN NSString *const UIKeyboardCenterEndUserInfoKey     NS_DEPRECATED_IOS(2_0, 3_2) __TVOS_PROHIBITED;
UIKIT_EXTERN NSString *const UIKeyboardBoundsUserInfoKey        NS_DEPRECATED_IOS(2_0, 3_2) __TVOS_PROHIBITED;

NS_ASSUME_NONNULL_END




作者:蓝田(Loto)
出处:

如果你觉得本篇文章对你有所帮助,请点击文章末尾下方“喜欢”
如有疑问,请通过以下方式交流:
评论区回复微信(加好友请注明“+称呼”)发送邮件[email protected]



本文版权归作者和本网站共有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接。

你可能感兴趣的:(【Xcode 7.3】UIWindow.h - UIKit)