| Inherits from | |
| Conforms to | |
| Framework | /System/Library/Frameworks/UIKit.framework |
| Availability | Available in iPhone OS 2.0 and later. |
| Declared in | UIWindow.h |
| Related sample code |
The UIWindow class defines objects (known as windows ) that manage and coordinate the windows an application displays on the screen. The two principal functions of a window are to provide an area for displaying its views and to distribute events to the views. The window is the root view in the view hierarchy. A window belongs to a level; the windows in one level appear above another level. For example, alerts appear above normal windows. Typically, there is only one window in an iPhone OS application.
Read Windows and Views in iPhone Application Programming Guide to learn how to use this class.
windowLevel property
– convertPoint:toWindow:
– convertPoint:fromWindow:
– convertRect:toWindow:
– convertRect:fromWindow:
For more about Objective-C properties, see “Properties” in The Objective-C Programming Language.
A Boolean value that indicates whether the receiver is the key window for the application. (read-only)
@property(nonatomic, readonly, getter=isKeyWindow) BOOL keyWindow
If YES, the receiver is the key window for the application; otherwise, NO.
UIWindow.hThe receiver’s window level.
@property(nonatomic) UIWindowLevel windowLevel
Levels are ordered so that each level groups windows within it in front of those in all preceding groups. For example, alert windows appear in front of all normal-level windows. When a window enters a new level, it’s ordered in front of all its peers in that level. See “UIWindowLevel” for a list of possible values. The default value is 0.0.
UIWindow.hInvoked automatically to inform the receiver that it has become the key window; never invoke this method directly.
- (void)becomeKeyWindow
This method reestablishes the receiver’s first responder, sends the becomeKeyWindow message to that object if it responds, and posts UIWindowDidBecomeKeyNotification to the default notification center.
UIWindow.hConverts a point from the coordinate system of a given window to that of the receiver.
- (CGPoint)convertPoint:(CGPoint)point fromWindow:(UIWindow *)window
A point specifying a location in the coordinate system of window.
The window with point in its coordinate system. If window is nil, this method instead converts from the screen’s base coordinates.
The point converted to the coordinate system of the receiver.
UIWindow.hConverts a point from the receiver’s coordinate system to that of another window.
- (CGPoint)convertPoint:(CGPoint)point toWindow:(UIWindow *)window
A point specifying a location in the coordinate system of the receiver.
The window into whose coordinate system point is to be converted. If nil, it converts the point to screen coordinates.
The point converted to the coordinate system of window.
UIWindow.hConverts a rectangle from the coordinate system of another window to that of the receiver.
- (CGRect)convertRect:(CGRect)rect fromWindow:(UIWindow *)window
The rectangle in the window's coordinate system.
The window with rect in its coordinate system. If nil, this method instead converts from screen’s base coordinates.
The converted rectangle.
UIWindow.hConverts a rectangle from the receiver’s coordinate system to that of another window.
- (CGRect)convertRect:(CGRect)rect toWindow:(UIWindow *)window
A rectangle in the receiver's coordinate system.
The window that is the target of the conversion operation. If nil, this method instead converts from screen base coordinates.
The converted rectangle.
UIWindow.hMakes the receiver the key window and makes that window visible.
- (void)makeKeyAndVisible
This is a convenience method to make the receiver the main window and displays it in front of other windows. You can also hide and reveal a window using the inherited hiddenUIView property.
UIWindow.hMakes the receiver the main window.
- (void)makeKeyWindow
UIWindow.hInvoked automatically when the window resigns key window status; never invoke this method directly.
- (void)resignKeyWindow
This method sends resignKeyWindow to the receiver’s first responder and posts UIWindowDidResignKeyNotification to the default notification center.
UIWindow.hDispatches events sent to the receiver by the UIApplication object to its views.
- (void)sendEvent:(UIEvent *)event
The event to process.
UIWindow.hThe positioning of windows relative to each other.
const UIWindowLevel UIWindowLevelNormal; const UIWindowLevel UIWindowLevelAlert; const UIWindowLevel UIWindowLevelStatusBar; typedef CGFloat UIWindowLevel;
UIWindowLevelNormalThe default level.
Available in iPhone OS 2.0 and later.
Declared in UIWindow.h.
UIWindowLevelAlertThe level for an alert view.
Available in iPhone OS 2.0 and later.
Declared in UIWindow.h.
UIWindowLevelStatusBarThe level for a status window.
Available in iPhone OS 2.0 and later.
Declared in UIWindow.h.
The stacking of levels takes precedence over the stacking of windows within each level. That is, even the bottom window in a level obscures the top window of the next level down. Levels are listed in order from lowest to highest.
Keys used to get values from the user information dictionary of keyboard notifications.
NSString *const UIKeyboardCenterBeginUserInfoKey; NSString *const UIKeyboardCenterEndUserInfoKey; NSString *const UIKeyboardBoundsUserInfoKey; NSString *const UIKeyboardAnimationDurationUserInfoKey; NSString *const UIKeyboardAnimationCurveUserInfoKey;
UIKeyboardCenterBeginUserInfoKeyThe key for an NSValue object containing a CGPoint that is the center of the keyboard in screen coordinates before animation.
Available in iPhone OS 2.0 and later.
Declared in UIWindow.h.
UIKeyboardCenterEndUserInfoKeyThe key for an NSValue object containing a CGPoint that is the center of the keyboard in screen coordinates after animation.
Available in iPhone OS 2.0 and later.
Declared in UIWindow.h.
UIKeyboardBoundsUserInfoKeyThe key for an NSValue object containing a CGRect that identifies the bounds rectangle of the keyboard. This value is sufficient for obtaining the size of the keyboard. If you want to get the origin of the keyboard on the screen (before or after animation) use the values obtained from the user info dictionary through the UIKeyboardCenterBeginUserInfoKey or UIKeyboardCenterEndUserInfoKey constants.
Available in iPhone OS 2.0 and later.
Declared in UIWindow.h.
UIKeyboardAnimationCurveUserInfoKeyThe key for an NSValue object containing a UIViewAnimationCurve constant that defines how the keyboard will be animated onto or off the screen.
Available in iPhone OS 3.0 and later.
Declared in UIWindow.h.
UIKeyboardAnimationDurationUserInfoKeyThe key for an NSValue object containing a double that identifies the duration of the animation in seconds.
Available in iPhone OS 3.0 and later.
Declared in UIWindow.h.
Posted when an UIWindow object becomes visible.
The notification object is the window object that has become visible. This notification does not contain a userInfo dictionary.
UIWindow.hPosted when an UIWindow object becomes hidden.
The notification object is the window object that has become hidden. This notification does not contain a userInfo dictionary.
UIWindow.hPosted whenever a UIWindow object becomes the key window.
The notification object is the window object that has become key. This notification does not contain a userInfo dictionary.
UIWindow.hPosted whenever a UIWindow object resigns its status as main window.
The notification object is the window object that has resigned its main window status. This notification does not contain a userInfo dictionary.
UIWindow.hPosted before a UIWindow object is displayed.
The notification object is nil. The userInfo dictionary contains information about the keyboard. Use the keys described in “Keyboard Notification User Info Keys” to get the location and size of the keyboard from the userInfo dictionary.
UIWindow.hPosted after a UIWindow object is displayed.
The notification object is nil. The userInfo dictionary contains information about the keyboard. Use the keys described in “Keyboard Notification User Info Keys” to get the location and size of the keyboard from the userInfo dictionary.
UIWindow.hPosted before a UIWindow object is hidden.
The notification object is nil. The userInfo dictionary contains information about the keyboard. Use the keys described in “Keyboard Notification User Info Keys” to get the location and size of the keyboard from the userInfo dictionary.
UIWindow.hPosted after a UIWindow object is hidden.
The notification object is nil. The userInfo dictionary contains information about the keyboard. Use the keys described in “Keyboard Notification User Info Keys” to get the location and size of the keyboard from the userInfo dictionary.
UIWindow.hLast updated: 2009-03-11