Ui2_ios coordinate system

Source: Internet
Author: User

////APPDELEGATE.M//Ui2_ios coordinate system////Created by zhangxueming on 15/6/29.//Copyright (c) 2015 zhangxueming. All rights reserved.//#import "AppDelegate.h"@interfaceappdelegate ()@end@implementationappdelegate-(BOOL) Application: (UIApplication *) application didfinishlaunchingwithoptions: (Nsdictionary *) launchoptions {//Override point for customization after application launch. //The default color of window is the transparent colorSelf.window.backgroundColor =[Uicolor Whitecolor]; //NSLog (@ "window =%@", Self.window);NSLog (@"x =%.2f y=%.2f w =%.2f h =%.2f", self.window.frame.origin.x, SELF.WINDOW.FRAME.ORIGIN.Y, Self.window.frame.size.width,    Self.window.frame.size.height); //iOS coordinate system//frame coordinates: coordinates relative to the parent view//bounds Coordinates: iOS coordinates (starting point from (0,0))//the height of the status bar isCGRect Frame=[[UIScreen mainscreen] bounds]; NSLog (@"x =%.2f y =%.2f w=%.2f h =%.2f", frame.origin.x, FRAME.ORIGIN.Y, Frame.size.width, frame.size.height); UIWindow*window1 = [[UIWindow alloc] Initwithframe:cgrectmake (Ten, -, self.window.frame.size.width- -, self.window.frame.size.height- -)]; Window1.backgroundcolor=[Uicolor Cyancolor];        [Self.window Addsubview:window1]; //make Window1 appear on the top level[Window1 makekeyandvisible]; //typically an application has a window (Windows)//equivalent to a containerUIView *view1 = [[UIView alloc] Initwithframe:cgrectmake ( -, -, self.window.frame.size.width- +, -)]; View1.backgroundcolor=[Uicolor Redcolor];        [Self.window Addsubview:view1]; //View1 's Retaincount plus 1//NSLog (@ "Retaincount =%li", view1.retaincount);Self.window.rootViewController=Nil; returnYES;}

Ui2_ios coordinate system

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.