Class: UIWindow

Inherits:
UIView show all

Overview

The UIWindow class defines an object known as a window that manages and coordinates the views an app displays on a device screen. Unless an app can display content on an external device screen, an app has only one window.

Instance Attribute Summary (collapse)

Attributes inherited from UIView

#alpha, #autoresizesSubviews, #autoresizingMask, #backgroundColor, #bounds, #center, #clearsContextBeforeDrawing, #clipsToBounds, #contentMode, #contentScaleFactor, #exclusiveTouch, #frame, #gestureRecognizers, #hidden, #layer, #multipleTouchEnabled, #opaque, #restorationIdentifier, #subviews, #superview, #tag, #transform, #userInteractionEnabled, #window

Attributes inherited from UIResponder

#inputAccessoryView, #inputView, #undoManager

Instance Method Summary (collapse)

Methods inherited from UIView

#addConstraint:, #addConstraints:, #addGestureRecognizer:, #addSubview:, #alignmentRectForFrame:, #alignmentRectInsets, animateWithDuration:animations:, animateWithDuration:animations:completion:, animateWithDuration:delay:options:animations:completion:, areAnimationsEnabled, beginAnimations:context:, #bringSubviewToFront:, commitAnimations, #constraints, #constraintsAffectingLayoutForAxis:, #contentCompressionResistancePriorityForAxis:, #contentHuggingPriorityForAxis:, #convertPoint:fromView:, #convertPoint:toView:, #convertRect:fromView:, #convertRect:toView:, #decodeRestorableStateWithCoder:, #didAddSubview:, #didMoveToSuperview, #didMoveToWindow, #drawRect:, #drawRect:forViewPrintFormatter:, #encodeRestorableStateWithCoder:, #endEditing:, #exchangeSubviewAtIndex:withSubviewAtIndex:, #exerciseAmbiguityInLayout, #frameForAlignmentRect:, #gestureRecognizerShouldBegin:, #hasAmbiguousLayout, #hitTest:withEvent:, #initWithFrame:, #insertSubview:aboveSubview:, #insertSubview:atIndex:, #insertSubview:belowSubview:, #intrinsicContentSize, #invalidateIntrinsicContentSize, #isDescendantOfView:, layerClass, #layoutIfNeeded, #layoutSubviews, #needsUpdateConstraints, #pointInside:withEvent:, #removeConstraint:, #removeConstraints:, #removeFromSuperview, #removeGestureRecognizer:, requiresConstraintBasedLayout, #sendSubviewToBack:, setAnimationBeginsFromCurrentState:, setAnimationCurve:, setAnimationDelay:, setAnimationDelegate:, setAnimationDidStopSelector:, setAnimationDuration:, setAnimationRepeatAutoreverses:, setAnimationRepeatCount:, setAnimationStartDate:, setAnimationTransition:forView:cache:, setAnimationWillStartSelector:, setAnimationsEnabled:, #setContentCompressionResistancePriority:forAxis:, #setContentHuggingPriority:forAxis:, #setNeedsDisplay, #setNeedsDisplayInRect:, #setNeedsLayout, #setNeedsUpdateConstraints, #setTranslatesAutoresizingMaskIntoConstraints:, #sizeThatFits:, #sizeToFit, #systemLayoutSizeFittingSize:, transitionFromView:toView:duration:options:completion:, transitionWithView:duration:options:animations:completion:, #translatesAutoresizingMaskIntoConstraints, #updateConstraints, #updateConstraintsIfNeeded, #viewForBaselineLayout, #viewPrintFormatter, #viewWithTag:, #willMoveToSuperview:, #willMoveToWindow:, #willRemoveSubview:

Methods inherited from UIResponder

#becomeFirstResponder, #canBecomeFirstResponder, #canPerformAction:withSender:, #canResignFirstResponder, #isFirstResponder, #motionBegan:withEvent:, #motionCancelled:withEvent:, #motionEnded:withEvent:, #nextResponder, #reloadInputViews, #remoteControlReceivedWithEvent:, #resignFirstResponder, #touchesBegan:withEvent:, #touchesCancelled:withEvent:, #touchesEnded:withEvent:, #touchesMoved:withEvent:

Methods inherited from NSObject

#!, #!=, #!~, #, #==, #===, #=~, #Rational, #__callee__, #__method__, #__send__, #__type__, `, alloc, allocWithZone:, #autoContentAccessingProxy, autoload, autoload?, autorelease_pool, #awakeAfterUsingCoder:, binding, block_given?, caller, cancelPreviousPerformRequestsWithTarget:, cancelPreviousPerformRequestsWithTarget:selector:object:, catch, class, classFallbacksForKeyedArchiver, #classForCoder, #classForKeyedArchiver, classForKeyedUnarchiver, #clone, conformsToProtocol:, #copy, copyWithZone:, #dealloc, #define_singleton_method, description, display, #doesNotRecognizeSelector:, #dup, #enum_for, #eql?, #equal?, #extend, fail, #finalize, format, #forwardInvocation:, #forwardingTargetForSelector:, framework, #freeze, #frozen?, getpass, gets, global_variables, #init, initialize, #initialize_clone, #initialize_copy, #initialize_dup, #inspect, instanceMethodForSelector:, instanceMethodSignatureForSelector:, #instance_eval, #instance_exec, #instance_of?, #instance_variable_defined?, #instance_variable_get, #instance_variable_set, #instance_variables, instancesRespondToSelector:, isSubclassOfClass:, #is_a?, iterator?, #kind_of?, lambda, load, load_bridge_support_file, load_plist, local_variables, loop, #method, #methodForSelector:, #methodSignatureForSelector:, #methods, #mutableCopy, mutableCopyWithZone:, new, #nil?, open, p, #performSelector:onThread:withObject:waitUntilDone:, #performSelector:onThread:withObject:waitUntilDone:modes:, #performSelector:withObject:afterDelay:, #performSelector:withObject:afterDelay:inModes:, #performSelectorInBackground:withObject:, #performSelectorOnMainThread:withObject:waitUntilDone:, #performSelectorOnMainThread:withObject:waitUntilDone:modes:, print, printf, #private_methods, proc, #protected_methods, #public_method, #public_methods, #public_send, putc, puts, raise, rand, readline, readlines, #replacementObjectForCoder:, #replacementObjectForKeyedArchiver:, require, resolveClassMethod:, resolveInstanceMethod:, #respond_to?, #respond_to_missing?, select, #send, setVersion:, #singleton_methods, sprintf, srand, superclass, #taint, #tainted?, #tap, test, throw, #to_plist, #to_s, trace_var, trap, #trust, #untaint, untrace_var, #untrust, #untrusted?, version

Constructor Details

This class inherits a constructor from NSObject

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class NSObject

Instance Attribute Details

- (Boolean) keyWindow (readonly)

A Boolean value that indicates whether the receiver is the key window for the application. (read-only) If YES, the receiver is the key window for the application; otherwise, NO.The key window is the one that is designated to receive keyboard and other non-touch related events. Only one window at a time may be the key window.

Returns:

  • (Boolean)

- (UIViewController) rootViewController

The root view controller for the window. The root view controller provides the content view of the window. Assigning a view controller to this property (either programmatically or using Interface Builder) installs the view controller’s view as the content view of the window. If the window has an existing view hierarchy, the old views are removed before the new ones are installed.The default value of this property is nil.

Returns:

- (UIScreen) screen

The screen on which the window is currently displayed. By default, all windows are created on the primary device screen. If additional screens are attached to the device, assigning a different screen object to this property causes the window to be displayed on the new screen. Moving windows from screen to screen is a relatively expensive operation and should not be done in performance-sensitive code. Instead, it’s recommended that you change the screen before displaying the window the first time. Changing the screen of a window that has not yet been ordered onto the screen has no significant additional cost.

Returns:

- (UIWindowLevel) windowLevel

The receiver’s window level. 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.

Returns:

  • (UIWindowLevel)

Instance Method Details

- (Object) becomeKeyWindow

Invoked automatically to inform the receiver that it has become the key window; never invoke this method directly. 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.

Returns:

- (CGPoint) convertPoint(point, fromWindow:window)

Converts a point from the coordinate system of a given window to that of the receiver.

Parameters:

  • point (CGPoint)

    A point specifying a location in the coordinate system of window.

  • window (UIWindow)

    The window with point in its coordinate system. If nil, this method converts the point from the logical coordinate system of the screen, which is measured in points.

Returns:

  • (CGPoint)

    The point converted to the coordinate system of the receiver.

- (CGPoint) convertPoint(point, toWindow:window)

Converts a point from the receiver’s coordinate system to that of another window.

Parameters:

  • point (CGPoint)

    A point specifying a location in the logical coordinate system of the receiver.

  • window (UIWindow)

    The window into whose coordinate system point is to be converted. If nil, this method converts the point to the logical coordinate system of the screen, which is measured in points.

Returns:

  • (CGPoint)

    The point converted to the coordinate system of window.

- (CGRect) convertRect(rect, fromWindow:window)

Converts a rectangle from the coordinate system of another window to that of the receiver.

Parameters:

  • rect (CGRect)

    The rectangle in the window's coordinate system.

  • window (UIWindow)

    The window with rect in its coordinate system. If nil, this method instead converts the rectangle from the logical coordinate system of the screen, which is measured in points.

Returns:

  • (CGRect)

    The converted rectangle.

- (CGRect) convertRect(rect, toWindow:window)

Converts a rectangle from the receiver’s coordinate system to that of another window.

Parameters:

  • rect (CGRect)

    A rectangle in the receiver’s coordinate system.

  • window (UIWindow)

    The window that is the target of the conversion operation. If nil, this method instead converts the rectangle to the logical coordinate system of the screen, which is measured in points.

Returns:

  • (CGRect)

    The converted rectangle.

- (Object) makeKeyAndVisible

Makes the receiver the key window and makes that window visible. 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 hidden property of UIView.

Returns:

- (Object) makeKeyWindow

Makes the receiver the main window.

Returns:

- (Object) resignKeyWindow

Invoked automatically when the window resigns key window status; never invoke this method directly. This method sends resignKeyWindow to the receiver’s first responder and posts UIWindowDidResignKeyNotification to the default notification center.

Returns:

- (Object) sendEvent(event)

Dispatches events sent to the receiver by the UIApplication object to its views.

Parameters:

  • event (UIEvent)

    The event to process.

Returns: