UIView--UIImageView
2016-01-19 10:23
453 查看
1.contentMode
view.contentMode = UIViewContentModeScaleAspectFill;
2.是否实现触摸
3.简单实现动画 图片的名字为campFire01-campFire17
NSMutableArray * imagearray = [NSMutableArray array];
for (int i = 1; i<=17; i++) {
//拼接图片的名字
NSString *name = [NSString stringWithFormat:@"campFire%@%d",i<10?@"0":@"",i];
//NSString *name = [NSString stringWithFormat:@"campFire%02d",i];
UIImage * image = [UIImage imageNamed:name];
[imagearray addObject:image];
}
UIImageView * view = [[UIImageView alloc]initWithFrame:CGRectMake(40, 40, 320-80, 568-80)];
view.contentMode = UIViewContentModeScaleAspectFit;
view.animationImages = imagearray;//直接接受数组
view.animationDuration = 2;//时间
view.animationRepeatCount = 0;//重复多少次 0表示无数次
[view startAnimating];
4.拉伸
- (UIImage *)stretchableImageWithLeftCapWidth:(NSInteger)leftCapWidth topCapHeight:(NSInteger)topCapHeight
这个函数是UIImage的一个实例函数,它的功能是创建一个内容可拉伸,而边角不拉伸的图片,需要两个参数,第一个是左边不拉伸区域的宽度,第二个参数是上面不拉伸的高度。
view.contentMode = UIViewContentModeScaleAspectFill;
2.是否实现触摸
3.简单实现动画 图片的名字为campFire01-campFire17
NSMutableArray * imagearray = [NSMutableArray array];
for (int i = 1; i<=17; i++) {
//拼接图片的名字
NSString *name = [NSString stringWithFormat:@"campFire%@%d",i<10?@"0":@"",i];
//NSString *name = [NSString stringWithFormat:@"campFire%02d",i];
UIImage * image = [UIImage imageNamed:name];
[imagearray addObject:image];
}
UIImageView * view = [[UIImageView alloc]initWithFrame:CGRectMake(40, 40, 320-80, 568-80)];
view.contentMode = UIViewContentModeScaleAspectFit;
view.animationImages = imagearray;//直接接受数组
view.animationDuration = 2;//时间
view.animationRepeatCount = 0;//重复多少次 0表示无数次
[view startAnimating];
4.拉伸
- (UIImage *)stretchableImageWithLeftCapWidth:(NSInteger)leftCapWidth topCapHeight:(NSInteger)topCapHeight
这个函数是UIImage的一个实例函数,它的功能是创建一个内容可拉伸,而边角不拉伸的图片,需要两个参数,第一个是左边不拉伸区域的宽度,第二个参数是上面不拉伸的高度。
相关文章推荐
- Android Volley入门到精通:定制自己的Request(示例,出错代码)
- ueditor调用其中的附件上传功能
- PHP 使用 $_SERVER['PHP_SELF'] 获取当前页面地址,$_SERVER['REQUEST_URI']获取完整参数URL
- 01-UI基础-04-02-UITableView多组数据显示
- IOS开发之自定义UITabBarController
- UIBezierPath贝塞尔曲线的常用方法总结
- 通过@Value注解读取.properties配置内容
- 【HDU】 1242 Rescue
- Duilib介绍以及各个类的简介
- 处理隐藏导航栏底部的横线首先要明白苹果导航栏底部横线用的是UIImageView
- Android UI线程和非UI线程
- EF框架step by step(9)—Code First Fluent API
- bzoj1570: [JSOI2008]Blue Mary的旅行
- CodeForces 527D Clique Problem
- async = require('async')
- iOS学习笔记5-UIView
- UIView动画——钟表的制作
- IOS学习笔记UI篇
- New UI-带图片(drawableXxx)的TextView
- UICollectionView学习总结