objective-c - 视图view.window返回当前keywindow吗?
ringa_lee
ringa_lee 2017-04-21 11:16:44
0
4
711

UIView.window属性来源于当前UIApplication.keyWindow,可以通过此属性让UIView间接获取到该视图的UIViewController类。

ringa_lee
ringa_lee

ringa_lee

reply all(4)
Ty80

I think UIView.window returns the window where the current view is located, not necessarily the keywindow

小葫芦
self.view.window 只是当前view的window,可能是keywindow
@property(nonatomic, readonly) UIWindow *window
Description	
The receiver’s window object, or nil if it has none. (read-only)
This property is nil if the view has not yet been added to a window.
[[UIApplication sharedApplication] keyWindow]
@property(nonatomic, readonly) UIWindow *keyWindow
This property holds the UIWindow object in the windows array that is most recently sent the makeKeyAndVisible message.
[[UIApplication sharedApplication] windows]
@property(nonatomic, readonly) NSArray *windows
This property returns an array of the application's visible and hidden windows. The windows are ordered back to front.
大家讲道理

In case view is a certain area on the keyboard, view.window is the window of the keyboard.

刘奇

Not necessarily.

Can be judged by view.window.keyWindow.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template