iOS界面编程-UIImageView
来源:互联网 发布:linux split 字符串 编辑:程序博客网 时间:2024/05/18 03:15
一、UIImageView介绍
一个UIImageView提供基于view的容器,用来显示单个图片或者可以用来展示一系列图片的动画。对于动画图片,UIImageView类提供动画周期和动画频率的控制方法。你可以自由的开始和停止动画。
二、相关方法
1、初始化对象
- (instancetype nonnull)initWithImage:(UIImage * nullable)image
- (instancetype nonnull)initWithImage:(UIImage * nullable)image highlightedImage:(UIImage * nullable)highlightedImage
2、image data
@property(nonatomic, strong) UIImage *image
@property(nonatomic,strong) UIImage *highlightedImage
@property(nonatomic,copy) NSArray <UIImage *> *animationImages
@property(nonatomic,copy) NSArray <UIImage *> *highlightedAnimationImages
@property(nonatomic)NSTimeInterval animationDuration
@property(nonatomic)NSInteger animationRepeatCount
- (void)startAnimating
- (void)stopAnimating
- (BOOL)isAnimating
@property(nonatomic,getter=isUserInteractionEnabled)BOOL userInteractionEnabled
@property(nonatomic,getter=isHighlighted)BOOL highlighted
@property(nonatomic,strong) UIColor * __null_unspecifiedtintColor
三相关列子
1、创建一个显示单个图片的UIInageView。
UIImageView *imageView = [[UIImageView alloc] initWithFrame:CGRectMake(10,20,self.view.frame.size.width - 20, 100)]; imageView.image = [UIImage imageNamed:@"bgnormol.png"]; imageView.backgroundColor = [UIColor whiteColor];//<span style="font-family: Arial, Helvetica, sans-serif;">UIImageView 背景颜色</span> imageView.highlightedImage = [UIImage imageNamed:@"bghighlighted.png"];//高亮下的图片 imageView.highlighted = YES;// 设置高亮显示 imageView.contentMode = UIViewContentModeScaleAspectFit;//设置分辨率匹配 [self.view addSubview:imageView];
2、创建显示一系列动画的UIImageView
UIImageView *myImage = [[UIImageView alloc]initWithFrame:CGRectMake(10, 280, self.view.bounds.size.width-20, 100)]; //新建一个UIImageView myImage.backgroundColor = [UIColor whiteColor];//背景颜色 UIImage *ig1= [UIImage imageNamed:@"bg1"]; UIImage *ig2= [UIImage imageNamed:@"bg2"]; UIImage *ig3= [UIImage imageNamed:@"bg3"]; UIImage *ig4= [UIImage imageNamed:@"bg4"]; myImage.animationImages = @[ig1,ig2,ig3,ig4];//设置其动画图片 myImage.animationDuration = 3;//动画事件 myImage.contentMode =UIViewContentModeScaleAspectFit;//设置内容模式,伸缩之类的操作 [myImage startAnimating];//设置开始动画 [self.view addSubview:myImage];
- iOS界面编程-UIImageView
- IOS界面开发之UIImageView
- iOS笔记-UIImageView
- iOS界面编程-UILabel
- iOS界面编程-UIPickerView
- iOS界面编程-UIProgressView
- iOS界面编程-UIActivityIndicatorView
- iOS界面编程-UIWebView
- iOS界面编程-UIAlertView
- iOS界面编程-UIButton
- iOS界面编程-UITextField
- iOS界面编程-UIDatePicker
- iOS界面编程-UIPageControl
- iOS编程-------UIImageView、手势识别器UIGestureRecognizer
- iOS-UIImageView添加事件
- iOS-UIImageView常用操作
- Swift开发IOS-UIImageView
- iOS-UIImageView
- ios-手势总结-清扫手势
- ACdream 1099 瑶瑶的第K大
- 简单对象写入文件
- MYSQL数据操作表
- struts.xml配置文件(一)
- iOS界面编程-UIImageView
- 《数学之美》之条件随机场与文法分析
- codeforces round 321 div2 题解
- SQL优化的思路及基本原则(mysql)
- 建造者模式
- [Machine Learning] Random Forest 随机森林
- 杭电
- CYC-NSFileManager的简单使用
- classpth+jamvm移植