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

IOS开发之控件之间的继承关系UILable,UIImageView

2015-12-01 19:27 507 查看
/*

控件之间的继承关系

UIlable

UIimageView

*/

/* UIView *view = [[UIView alloc]init];

view.frame = CGRectMake(100, 100, 300, 300);

view.backgroundColor;

view.alpha,

[self.window addSubview:view];

// UILabel = 标签控件 ,适合来放置一些文本 但不适合放置太多的文本 适合放置一些短的文本

// 把labal对象实例话 任何对象都是要实例化

UILabel *lable = [[UILabel alloc]init];

// 给lable设置frame

lable.frame =CGRectMake(200, 200, 200, 200);

lable.text = @"我的个仙人板板儿你老是在那嗷嗷叫!";

lable.textColor = [UIColor blackColor];

lable.shadowColor = [UIColor redColor];//设置阴影并给设置阴影颜色

lable.shadowOffset = CGSizeMake(2, 2);//设置阴影宽度和高度

lable.numberOfLines = 1;//0 代表的是自适应行数 非0 是几就是几行

// 使字体居中;

lable.textAlignment = NSTextAlignmentCenter;

// 系统默认字体 并给设置字体大小;

// UIFont* font = [UIFont boldSystemFontOfSize:25];

// lable.font = font;

// 在加粗的时候同时设置字体

// 在设置斜体的时候同时设置字体大小

lable.font = [UIFont italicSystemFontOfSize:25];

// 让内容尽量一行显示出来

lable.adjustsFontSizeToFitWidth = YES;

// 创建背景颜色

lable.backgroundColor = [UIColor yellowColor];

lable.alpha = 0.5;

// 最后把 创建的标签贴在父视图上面

[self.window addSubview:lable];

// UIColor

// UIFont 都是一种类 把他们创造出来必须要实例化

// UIImageView用来显示图片

UIImageView *imgview = [[UIImageView alloc]init];

imgview.image = [UIImage imageNamed:@"/Users/scsys/Desktop/Ui no -2/Ui no -2/1.tiff"];//如果此图片是png格式的不需要加后缀

//创建帧动画的四要素

// 1. 设置动画的时间间隔

imgview.animationDuration = 5;

// 2. 准备图片素材

UIImage *img1 = [UIImage imageNamed:@"/Users/scsys/Desktop/Ui no -2/Ui no -2/1.tiff"];

UIImage *img2 = [UIImage imageNamed:@"/Users/scsys/Desktop/Ui no -2/Ui no -2/未命名文件夹/2.tiff"];

UIImage *img3 = [UIImage imageNamed:@"/Users/scsys/Desktop/Ui no -2/Ui no -2/未命名文件夹/3.tiff"];

UIImage *img4 = [UIImage imageNamed:@"/Users/scsys/Desktop/Ui no -2/Ui no -2/未命名文件夹/4.tiff"];

UIImage *img5 = [UIImage imageNamed:@"/Users/scsys/Desktop/Ui no -2/Ui no -2/未命名文件夹/5.tiff"];

UIImage *img6 = [UIImage imageNamed:@"/Users/scsys/Desktop/Ui no -2/Ui no -2/未命名文件夹/6.tiff"];

UIImage *img7 = [UIImage imageNamed:@"/Users/scsys/Desktop/Ui no -2/Ui no -2/未命名文件夹/ 7.tiff"];

UIImage *img8 = [UIImage imageNamed:@"/Users/scsys/Desktop/Ui no -2/Ui no -2/未命名文件夹/8.tiff"];

UIImage *img9 = [UIImage imageNamed:@"/Users/scsys/Desktop/Ui no -2/Ui no -2/未命名文件夹/9ff.tiff"];

UIImage *img10 = [UIImage imageNamed:@"/Users/scsys/Desktop/Ui no -2/Ui no -2/未命名文件夹/10.tiff"];

UIImage *img11 = [UIImage imageNamed:@"/Users/scsys/Desktop/Ui no -2/Ui no -2/未命名文件夹/11.tiff"];

UIImage *img12 = [UIImage imageNamed:@"/Users/scsys/Desktop/Ui no -2/Ui no -2/未命名文件夹/12.tiff"];

UIImage *img13 = [UIImage imageNamed:@"/Users/scsys/Desktop/Ui no -2/Ui no -2/未命名文件夹/13.tiff"];

UIImage *img14 = [UIImage imageNamed:@"/Users/scsys/Desktop/Ui no -2/Ui no -2/未命名文件夹/14.tiff"];

UIImage *img15 = [UIImage imageNamed:@"/Users/scsys/Desktop/Ui no -2/Ui no -2/未命名文件夹/15.tiff"];

NSArray *array = @[img1,img2,img3,img4,img5,img6,img7,img8,img9,img10,img11,img12,img13,img14,img15];//准备素材

imgview.animationImages = array;

// 3.设置重复次数

imgview.animationRepeatCount = 0;

// 4.开始动画

[imgview startAnimating];

imgview.frame = CGRectMake(10, 10, 200, 200);

[self.window addSubview:imgview];

宏定义:

#define kContain @“我改过的内容”/[mainscreen] 作用:用内容替换变量名字

*/
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: