iOS新手入门之UIView
来源:互联网 发布:c 棋牌游戏源码 编辑:程序博客网 时间:2024/06/06 02:11
#import "AppDelegate.h"// 获取屏幕的高度 宽度// 自定义宏#define kScreenWidth [UIScreen mainScreen].bounds.size.width#define kScreenHeight [UIScreen mainScreen].bounds.size.height@interface AppDelegate ()@end@implementation AppDelegate
内存管理为MRC的情况下
// 内存管理- (void)dealloc;{ [_window release]; [super dealloc];}- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { self.window = [[[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]] autorelease]; self.window.backgroundColor = [UIColor greenColor];// 创建UIView// 1.初始化空间 Frame是指在屏幕的位置 左上角为(0,0)点 后面两个200指的是长和宽 用来约束大小UIView *aView = [[UIView alloc] initWithFrame:(CGRectMake(50, 50, 200, 200))];// 2.设置属性 例如 背景颜色aView.backgroundColor = [UIColor blackColor];// 3.显示试图 添加到window上[self.window addSubview:aView];// 4.注意!!!释放内存[aView release];[self.window makeKeyAndVisible]; return YES;}
内存管理为ARC情况下
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; self.window.backgroundColor = [UIColor greenColor];// 创建UIView// 1.初始化空间 Frame是指在屏幕的位置 左上角为(0,0)点 后面两个200指的是长和宽 用来约束大小UIView *aView = [[UIView alloc] initWithFrame:(CGRectMake(50, 50, 200, 200))];// 2.设置属性 例如 背景颜色aView.backgroundColor = [UIColor blackColor];// 3.显示试图 添加到window上[self.window addSubview:aView];[self.window makeKeyAndVisible]; return YES;}
0 0
- iOS新手入门之UIView
- iOS新手入门之UILable
- iOS新手入门之UIButton
- iOS新手入门之UITextField
- ios开发之Swift新手入门
- IOS之UIView详解
- iOS 开发之 UIView
- IOS开发之UIView
- iOS大典之UIView
- iOS学习之UIView
- iOS之UIView动画
- iOS之UIView Animation
- iOS之UIView Animations
- IOS疯狂基础之UIView
- IOS开发之UIView总结
- IOS UIView 之属性篇
- IOS UIView 之属性篇
- iOS动画之UIView实现
- Win7与ubuntu双系统开机找不到ubuntu引导项问题解决
- android自定义dialog,添加了selector和shape混合使用
- 逻辑地址、线性地址、物理地址以及虚拟存储器
- 深入Java集合学习系列:TreeMap实现
- 面试题28:字符串的排列
- iOS新手入门之UIView
- Fresco(2)——fresco的基本使用
- c++ primer 第四章习题(2)
- HDOJ2087 剪花布条(kmp)
- Precision & Recall & F1
- 机器学习中的特征——特征选择的方法以及注意点
- 分布式基础学习_分布式计算系统(Map/Reduce)
- 揭秘Mysql 5.6 Index Condition Pushdown(ICP)
- 算法-递归分治(经典例子)