您的位置:首页 > 产品设计 > UI/UE

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);
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: