UILabel+UIImageView(动画)
来源:互联网 发布:知乎付费方式 编辑:程序博客网 时间:2024/06/07 17:30
UILabel标签控件,适合放一些短的文本。
UILabel继承于 UIView
要把创建的视图放在他的父视图上
[self.windowaddSubview:label];
☐UILabel的属性
①把label对象实例化,并设置fram(任何对象都要实例化)
UILabel*label = [[UILabelalloc]initWithFrame:CGRectMake(200,200, 200, 40)];
②设置文本
label.text= @"Starasdfghjklzxcadsgvbnv";
③label背景颜色
label.backgroundColor= [UIColor redColor];
④设置字体颜色
label.textColor= [UIColorwhiteColor];
⑤设置对齐方式
label.textAlignment= NSTextAlignmentCenter;
⑥设置字体大小
label.font= [UIFontsystemFontOfSize:22];
⑦在加粗的同时设置字体大小
label.font= [UIFont boldSystemFontOfSize:24];
⑧在设置斜体的同时,设置字体大小
label.font= [UIFontitalicSystemFontOfSize:25];
⑨shadowColor设置阴影并设置阴影颜色
label.shadowColor= [UIColor blackColor];
⑩shadowOffset设置阴影偏移量
label.shadowOffset= CGSizeMake(2,4);
⑪给内容设置行数,0代表自适应行数,非0,是几行就是几行
label.numberOfLines= 0;
⑫自适应字体,让内容尽量一行显示
label.adjustsFontSizeToFitWidth= YES;
--------------------------------------------------------
☐UIImageView用来显示图片
UIImageView*imgView = [[UIImageViewalloc]initWithFrame:CGRectMake(10,10,300,300)];
如果图片是PNG格式,图片名不需要加后缀,否则都要加
imgView.image= [UIImage imageNamed:@"1.tiff"];
创建帧动画四要素:
1.设置间隔时间
2.准备图片素材
3.设置重复次数
4.开始动画
①设置动画的时间间隔
imgView.animationDuration= 2;
②给帧动画准备素材
UIImage*img1 = [UIImageimageNamed:@"1.tiff"];
UIImage*img2 = [UIImageimageNamed:@"2.tiff"];
UIImage*img3 = [UIImageimageNamed:@"3.tiff"];
NSArray*array = @[img1,img2,img3];
imgView.animationImages= array;
③给动画设置重复次数(0是无限循环)
imgView.animationRepeatCount= 0;
④开始动画
[imgViewstartAnimating];
延迟多少秒后执行相应的方法 用selector选择的方法一定要实现,否则会崩溃
[selfperformSelector:@selector(start)withObject:nilafterDelay:5];
0 0
- UILabel+UIImageView(动画)
- UILabel—uiimageview----图片动画实现
- UIButton,UIImageView,UILabel,UITextField
- UILabel, UITextField, UIImageView
- UILabel,UITextField,UIButton,UIimageView
- UIImageView 动画
- UIImageView动画
- UIimageView 动画
- UIImageView动画
- UI控件笔记(二):UI之UILabel和UIImageView
- UILabel和UIImageView的使用
- UILabel、UITextField、UIButton、UIImageView控件
- Swift - UIView,UILabel,UIButton,UIImageView
- iOS UILabel UIButton UIImageView使用方法
- UI之UILabel和UIImageView
- 汤姆猫程序(UIImageView动画)
- 图片数组形成动画(UIImageView)
- 利用UIImageView实现动画
- Leetcode214: Remove Invalid Parentheses
- iOS: 在UIViewController 中添加Static UITableView
- git的学习和使用
- 更改eclipse的编辑器样式风格
- codeforces 611C New Year and Domino (DP)
- UILabel+UIImageView(动画)
- 围观M$的new
- 【HDU4001】To Miss Our Children Time(LIS变形)
- 关于国外硕博士论文搜索和下载的讨论
- java一点浅薄的东西 分享2
- Android自带刷新控件SwipeRefreshLayout扩展,支持ListView下拉刷新
- LAMP---文章发布系统
- 解决android.view.InflateException: Binary XML file line #8: Error inflating class
- MFC之CDC类