UI UIView
来源:互联网 发布:qq显示mac在线 没有了 编辑:程序博客网 时间:2024/05/19 19:41
//// VisionAppDelegate.m// UIView//// Copyright (c) 2014年 Vision. All rights reserved.//#import "VisionAppDelegate.h"@implementation VisionAppDelegate- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions{ //创建一个UIWindows的对象 跟屏幕一样大 self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; // Override point for customization after application launch. //设置背景颜色 self.window.backgroundColor = [UIColor colorWithRed:0.9 green:0.1 blue:0.4 alpha:1]; //设置这个window为主windows,并使其可见 [self.window makeKeyAndVisible]; //UIView的使用 //学习一个新类 //1.看继承关系 //2.有没有自己的初始化方法 //frame是UIView的一个属性,作用:规定view的位置和大小 UIView *view = [[UIView alloc]initWithFrame:CGRectMake(150, 150, 55, 55)]; //把view添加到另一个view(UIWindow)上 view.backgroundColor = [UIColor colorWithRed:0.1 green:0.9 blue:0.6 alpha:1]; [self.window addSubview:view];//对view引用计数加1 //内存管理 [view release]; UIView *otherView = [[UIView alloc]initWithFrame:CGRectMake(100, 100, 100, 88)]; otherView.backgroundColor = [UIColor greenColor]; [self.window addSubview:otherView]; [otherView release]; //将一个View放到最前面 [self.window bringSubviewToFront:view]; //将一个view放到后面 [self.window sendSubviewToBack:view]; //将某个view从父视图移除 [view removeFromSuperview];//调用该方法 会使得自己引用计数-1 如果 view上还有view 一并移除掉 //view的相关设置 //透明度 (0 - 1float)带着所有子视图透明度一起改变 otherView.alpha = 0.3; //隐藏(YES隐藏 / NO显示) otherView.hidden = YES; //获得自己的父视图 NSLog(@"view的父视图:%@", otherView.superview); //获得一个view的子视图 NSLog(@"view的子视图:%@", otherView.subviews); //tag值 //给view加一个编号,方便父视图查找某个子视图 otherView.tag = 10000; //父视图找子视图的方法 UIView *searchView = [self.window viewWithTag:10000]; NSLog(@"%@,",searchView); //透明的颜色是clearColor //内存管理 [_window release]; return YES;}- (void)dealloc{ [_window release]; [super dealloc];}
0 0
- UI UIView
- UI-UIView
- UI--UIView
- UI基础UIWindow、UIView
- 12、UIView-OC+UI
- UI-第一讲UIView
- UI学习(一)UIView
- UI基础之 UIview
- UI的类--UIView
- UI 01 UIView
- UI第一讲(UIView)
- UI基础知识 -- UIView UILabel
- UI第一天UIView
- UI 和 UIView
- UI/UIWindow/UIView
- UI day 1 UIView
- IOS UI-UIView
- UI- UIWindow & UIView
- lua 中string字符串的使用(string.len, string.char)
- Mina-2.0.7源码学习 (2)
- 常见数据格式
- 研磨设计模式之外观模式(Facade)(场景问题)
- 【android】getCacheDir()、getFilesDir()、getExternalFilesDir()、getExternalCacheDir()的作用
- UI UIView
- UI基本组件和几大布局
- 如何禁止UIWebView滚动 (拉到适合的高度)
- cclientX,pageX,screenX等详解。
- 发潍坊人啊W分热熔法尔发而通风虽然特他如果如果人和法塔赫
- java处理ip的工具类
- 微软高管:Win8用户可免费升级Win9系统
- 关于C++中的大小端、位段(惑位域)和内存对齐
- 大型网站系统架构演化之路