UI2_IOS坐标系
2015-07-11 11:04
471 查看
// // AppDelegate.m // UI2_IOS坐标系 // // Created by zhangxueming on 15/6/29. // Copyright (c) 2015年 zhangxueming. All rights reserved. // #import "AppDelegate.h" @interface AppDelegate () @end @implementation AppDelegate - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { // Override point for customization after application launch. //window的默认颜色是透明色 self.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坐标系 //frame坐标: 相对于父视图的坐标 //bounds坐标:ios坐标(起始点从(0,0)开始) //状态栏的高度是20 CGRect 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(10, 50, self.window.frame.size.width-20, self.window.frame.size.height-100)]; window1.backgroundColor = [UIColor cyanColor]; [self.window addSubview:window1]; //使window1在最上层显示 [window1 makeKeyAndVisible]; //通常一个应用程序有一个Window(窗口) //相当于一个容器 UIView *view1 = [[UIView alloc] initWithFrame:CGRectMake(20, 100, self.window.frame.size.width-40, 50)]; view1.backgroundColor = [UIColor redColor]; [self.window addSubview:view1]; //view1的retainCount加1 //NSLog(@"retainCount = %li", view1.retainCount); self.window.rootViewController = nil; return YES; }
相关文章推荐
- UEditor富文本编辑器,轻量,可定制,注重用户体验
- UI1_应用的程序的生命周期
- UI_模态页面跳转
- 三)Unix文件I/O(1)
- Android UI细节知识点一(edittext、listview、填充屏幕等)
- UI基础:UIControl及其子类
- Win7 64位系统搭建:UE4+CEGUI+VS2013游戏框架二
- UIView的setNeedsLayout, layoutIfNeeded 和 layoutSubviews 方法之间的关系解释
- 苹果开发 笔记(48) UIImage CIImage CGImageRef
- iOS中UILabel的用法(三 )
- LeetCode Implement Stack using Queues
- android程序中出现Type android:actionModeShareDrawable requires API level 21 (the min is 8)的解决方案
- Win7 64位系统搭建:UE4+CEGUI+VS2013游戏框架一
- UI基础:target...action设计模式,手势识别器.UIimageview
- Calling startActivity() from outside of an Activity context requires the FLAG_ACTIVITY_NEW _TASK flag.
- c#利用WebClient和WebRequest获取网页源代码的比较
- java初级笔记_GUI
- [Android--UI]TextView的使用学习
- [Android--UI]界面设计原则
- [Android--UI]EditText的使用问题