UI基础学习第一天
2016-01-23 16:10
597 查看
//创建并初始化window,给定屏幕大小 self.window = [UIWindow alloc]initWithFrame:[[UIScreen mainScreen].bounds] //设置背景颜色 self.window setBackgroundColor: [UIColorcolorWithRed:243/255.0green:208/255.0blue:56/255.0alpha:1]] //作为主window并且显示 [self.windowmakeKeyAndVisible]; //设置根视图控制器 [self.windowsetRootViewController:[UIViewControllernew]]; //将某一个子视图放到最后面 //// [self.window sendSubviewToBack:view2]; // //将一个子视图移到最前面 //// [self.window bringSubviewToFront:view1]; // //交换视图 // [self.window exchangeSubviewAtIndex:0 withSubviewAtIndex:1]; // //从父视图移除 //// [view2 removeFromSuperview]; //中心点 View.center = CGPointMake(self.window.frame.size.width/2, self.window.frame.size.height/2); //控制视图显隐 View.hidden =NO;//(是否隐藏) //控制视图透明度 View.alpha = 1;//(0-1之间) //标签 View.tag = 101; //用来做标记的 //获取父视图(获取的是视图(强转)) UIWindow *window = (UIWindow *)View.superview; //获取子视图(用数组) NSArray *array = View.subviews; // UILabel *label = [[UILabel alloc]initWithFrame:CGRectMake(0, 0, 200, 100)]; // label.center = CGPointMake(self.window.bounds.size.width/2, self.window.bounds.size.height/2); // //设置label的颜色 // label.backgroundColor = [UIColor whiteColor]; // //设置label文本 // label.text = @"人生若只如初见,何事秋风悲画扇,等闲变却故人心,却道故人心易变."; // //文本对齐方式 // label.textAlignment = NSTextAlignmentCenter; // //文本颜色 // label.textColor = [UIColor magentaColor]; // //文本字体大小 //// label.font = [UIFont fontWithName:@"" size:22.0]; // label.font = [UIFont systemFontOfSize:25]; // //文本阴影 // label.shadowOffset = CGSizeMake(2, -2);//偏移量 // label.shadowColor = [UIColor cyanColor];//阴影颜色 // //文本边框 // label.layer.borderWidth = 3;//边框宽度 // label.layer.borderColor = [UIColor redColor].CGColor;//边框颜色 // //文本圆角 // label.layer.cornerRadius = 10;//内切圆半径 // label.layer.masksToBounds = YES;//切除多余部分 // //设置文本行数 // label.numberOfLines= 4; // //文本换行模式 // label.lineBreakMode= NSLineBreakByWordWrapping; // //添加到父视图 // [self.window addSubview:label]; //旋转 // sh.transform = CGAffineTransformMakeRotation(M_PI);
相关文章推荐
- UIWindow
- UITextView详解
- HDU 4096 Universal Question Answering System(输入用gets或getchar)
- Data Binding Guide from Android
- 【CODEFORCES】 B. Queue
- UIButton的详细介绍:
- Bluetooth Low Energy 嗅探
- UI_自定义标签控制器
- UI_标签导航控制器
- UI_协议传值
- UI_Block传值
- UI_视图导航器
- UI_滚动视图
- UI_滑竿,分段控制器
- UI_手势
- UI_炫彩方框,旋转跑马灯,炫彩画板
- UI_Button的应用
- UI_封装
- Leetcode 63. Unique Paths II
- KeyValueCoding