UIWindow All API learning.

Source: Internet
Author: User
Tags uikit

The purpose of writing the API is to function as a dictionary. Simple, clear, brush up, review.

//1. Define a CGFloat type of uiwindowlevel,uiwindowlevel is divided into three different choices, defining uiwindow different levels of presentation,UIWindow In reality, different sorts are made according to three different choices, that is, the level will be in front of levels lower than his.

typedef CGFloat Uiwindowlevel;


2. Add UIScreen Screen Properties

@property (nonatomic,retain) UIScreen *screen Ns_available_ios (3_2); Default is [UIScreen mainscreen]. Changing the screen is a expensive operation and should not being done in performance-sensitive code

//3. Uiwindowlevel Property

@property (nonatomic)                   uiwindowlevel Windowlevel; //default = 0.0

//4.keywindow is the specified message to receive the keyboard and non-touch classes, and only one window per time in the program is Keywindow

@property(nonatomic,readonly,getter=iskeywindow)BOOL Keywindow;

//5. Setting the current window into the main window

-(void) Becomekeywindow; //Override point for subclass. Don't call directly

6. Discard the current main window

-(void) Resignkeywindow; //Override point for subclass. Don't call directly

7. make the current window into keywindow

-(void) Makekeywindow;

8. make the current window into keywindowand show it

-(void) makekeyandvisible; //convenience. Most apps call this to show the main window and also make it key. Otherwise use view hidden property


9. Set UIView Controller for Root

@property (nonatomic,retain)  uiviewcontroller *rootviewcontroller ns_available_ios(4_0); //default is nil

10. When an event is generated, it is passed to UIApplication, and Uiappliaction passes the event UIWindow for processing, which is then passed by UIWindow to a specific object, first responder, And UIWindow is through sendevent to find first responder, after sendevent distribution to the appropriate object, Sendevent is equivalent to the time of the transit.

-(void) sendevent: ( uievent                   *) event; //called by UIApplication to dispatch events to views inside the window


//11. Converts a coordinate of the current window to a coordinate relative to another window

-(cgpoint) Convertpoint: (cgpoint) point Towindow: (uiwindow *) window; //Can be used to convert to another window

//12. Converts one coordinate of another window to the coordinates of the current window

-(cgpoint) Convertpoint: (cgpoint) point Fromwindow: (uiwindow *) window; //Pass in nil to mean screen

13. Convert the current window a rectangular coordinate relative to the current window's coordinates.

-(cgrect) Convertrect: (cgrect) rect towindow: (uiwindow *) window;

//14. Convert inside the outer window a rectangular coordinate relative to the current window's coordinates

-(cgrect) Convertrect: (cgrect) rect fromwindow: (uiwindow *) window;


@end


//15. definition UIWindow Display the choice of different levels of priority, according to the principle of window display level first, high level of gray display above, low level below, our program is displayed at the bottom of the normal

Uikit_externconstuiwindowlevel uiwindowlevelnormal; The default window is the normal level, the value of the priority value is 0, and the interface of our program is usually at this normal level.

Uikit_extern Const Uiwindowlevel Uiwindowlevelalert; //Screen StatusBar at medium level with a priority value of

Uikit_externconstuiwindowlevel uiwindowlevelstatusbar;//alert Levels, typically Uialertview and uialertsheet, are used to interrupt normal processes, alerting users to operations. The priority value is 2000. According to this, Alertview box out below is also a layer of uiwindow, but is the highest priority of the alert level, so is Keywindow, the current only interactive alert, which is why the frame out of other interfaces are not interactive reason


//16. Next is four notifications of window changes

Uikit_extern nsstring *const uiwindowdidbecomevisiblenotification; when the window is displayed it will be called

Uikit_extern  nsstring *const uiwindowdidbecomehiddennotification; Window is hidden and called, it should be noted that when the program enters the background, these two notifications will not be called, even if the app goes to the background, the Windows will not be displayed, the context of the window application is still considered visible

Uikit_extern     nsstring *const uiwindowdidbecomekeynotification; Window is called as the main windows

Uikit_extern     nsstring *const uiwindowdidresignkeynotification; Window undo main Window Call


17. Notifications for monitoring keyboard changes

Uikit_extern nsstring *const uikeyboardwillshownotification; called when the keyboard is going to be displayed

Uikit_extern nsstring *const uikeyboarddidshownotification; called when the keyboard is already displayed

Uikit_extern nsstring *const uikeyboardwillhidenotification; called when the keyboard is going to be hidden

Uikit_extern nsstring *const uikeyboarddidhidenotification; //When the keyboard is hidden, call


//18. Some userinfo messages about listening for keyboard notifications

UIKIT _extern nsstring *const uikeyboardframebeginuserinfokey       ns_available_ios ( Span style= "COLOR: #0435ff" >3 _2); position of the animated front keyboard, including CGRect Nsvalue can be written in the notification method location cgrect rect = [[Notif.userinfo Objectforkey:uikeyboardframeenduserinfokey] Cgrectvalue];

UIKIT _extern nsstring *const uikeyboardframeenduserinfokey         ns_available_ios (3 _2); // animation at the end of the keyboard position   include Cgrect nsvalue

Uikit_extern nsstring *const Uikeyboardanimationdurationuserinfokeyns_available_ios(3_0); //The duration of the animation, the value is NSNumber

Uikit_extern nsstring *const Uikeyboardanimationcurveuserinfokey ns_available_ios(3_0); the curve type of the animation (Uiviewanimationcurve), the value is NSNumber


//19. Monitor keyboard frame size Change notification

Uikit_extern nsstring *const uikeyboardwillchangeframenotification Ns_available_ios(5_0); called when the keyboard frame value is going to change

Uikit_extern nsstring *const uikeyboarddidchangeframenotification Ns_available_ios(5_0); called when the keyboard frame value has changed

// Below are some deprecated APIs, not much to explain

Uikit_extern nsstring *const Uikeyboardcenterbeginuserinfokey Ns_deprecated_ios(2_0, 3_2);

Uikit_extern nsstring *const Uikeyboardcenterenduserinfokey Ns_deprecated_ios(2_0,3 _2);

Uikit_extern nsstring *const Uikeyboardboundsuserinfokey Ns_deprecated_ios(2_0,3 _2);

UIWindow All API learning.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.