////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