iOS-UIKit框架学习—UIWindow

一个UIWindow对象提供了您的应用程序的用户界面的背景和提供了重要的事件处理行为。Windows没有自己的任何视觉外观,但它们对于应用程序视图的呈现至关重要。屏幕上显示的每个视图都由一个窗口包围,每个窗口独立于应用程序中的其他窗口。应用程序接收的事件最初会传送到相应的窗口对象,然后将这些事件转发到相应的视图。Windows与您的视图控制器一起实现方向更改,并执行许多其他任务,这些任务是您应用程序操作的基础。

// 相对窗的定位
typedef CGFloat UIWindowLevel;

@class UIEvent, UIScreen, NSUndoManager, UIViewController;

NS_CLASS_AVAILABLE_IOS(2_0) @interface UIWindow : UIView
// 显示窗口的屏幕
@property(nonatomic,strong) UIScreen *screen NS_AVAILABLE_IOS(3_2);
// 该窗口在Z轴的位置。
@property(nonatomic) UIWindowLevel windowLevel;                   // default = 0.0
// 该窗口是不是应用的主视图
@property(nonatomic,readonly,getter=isKeyWindow) BOOL keyWindow;
// 通知已经变为主视图
- (void)becomeKeyWindow;
// 通知应经不是主视图
- (void)resignKeyWindow;
// 接收关键窗口
- (void)makeKeyWindow;
// 显示窗口并使其成为关键窗口
- (void)makeKeyAndVisible;
// 窗口的跟视图控制器
@property(nullable, nonatomic,strong) UIViewController *rootViewController NS_AVAILABLE_IOS(4_0);  // default is nil
// 发送指定事件 UIApplication通过此方法来调度事件窗口
- (void)sendEvent:(UIEvent *)event;
// 转换一个点从接受对象的坐标系到指定窗口
- (CGPoint)convertPoint:(CGPoint)point toWindow:(nullable UIWindow *)window;
// 与上面相反,指定窗口坐标中的一个点转换为接收对象
- (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 NSNotificationName const UIWindowDidBecomeVisibleNotification;
UIKIT_EXTERN NSNotificationName const UIWindowDidBecomeHiddenNotification;
UIKIT_EXTERN NSNotificationName const UIWindowDidBecomeKeyNotification;
UIKIT_EXTERN NSNotificationName const UIWindowDidResignKeyNotification;

UIKIT_EXTERN NSNotificationName const UIKeyboardWillShowNotification __TVOS_PROHIBITED;
UIKIT_EXTERN NSNotificationName const UIKeyboardDidShowNotification __TVOS_PROHIBITED;
UIKIT_EXTERN NSNotificationName const UIKeyboardWillHideNotification __TVOS_PROHIBITED;
UIKIT_EXTERN NSNotificationName const UIKeyboardDidHideNotification __TVOS_PROHIBITED;

UIKIT_EXTERN NSString *const UIKeyboardFrameBeginUserInfoKey        NS_AVAILABLE_IOS(3_2) __TVOS_PROHIBITED; // NSValue of CGRect
UIKIT_EXTERN NSString *const UIKeyboardFrameEndUserInfoKey          NS_AVAILABLE_IOS(3_2) __TVOS_PROHIBITED; // NSValue of CGRect
UIKIT_EXTERN NSString *const UIKeyboardAnimationDurationUserInfoKey NS_AVAILABLE_IOS(3_0) __TVOS_PROHIBITED; // NSNumber of double
UIKIT_EXTERN NSString *const UIKeyboardAnimationCurveUserInfoKey    NS_AVAILABLE_IOS(3_0) __TVOS_PROHIBITED; // NSNumber of NSUInteger (UIViewAnimationCurve)
UIKIT_EXTERN NSString *const UIKeyboardIsLocalUserInfoKey           NS_AVAILABLE_IOS(9_0) __TVOS_PROHIBITED; // NSNumber of BOOL

UIKIT_EXTERN NSNotificationName const UIKeyboardWillChangeFrameNotification  NS_AVAILABLE_IOS(5_0) __TVOS_PROHIBITED;
UIKIT_EXTERN NSNotificationName const UIKeyboardDidChangeFrameNotification   NS_AVAILABLE_IOS(5_0) __TVOS_PROHIBITED;

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;

你可能感兴趣的:(iOS-UIKit框架学习—UIWindow)