iOS基石——UIIage
来源:互联网 发布:win7系统网络驱动下载 编辑:程序博客网 时间:2024/04/30 05:41
UIImageView&&UIImage的使用
图片显示模式
//默认图片会显示全 比例不一样大会变形 imageV.image = [UIImage imageNamed:@"back.jpg"]; //超出父视图的部分将被裁剪掉 _foregroundImageV.clipsToBounds = YES; //内容布局方式(图片的停靠模式) imageV.contentMode = UIViewContentModeCenter; /* UIViewContentModeScaleToFill,//默认 显示全(充满整个控件 ) UIViewContentModeScaleAspectFit,//图片显示全 不会变形 比例不一样 不会充满整个控件 UIViewContentModeScaleAspectFill,//图片不变形 但是比例不同图片可能超出控件 */
图片数组的播放
//imageView播放一组图片 UIImageView * imageView3 = [[UIImageView alloc] initWithFrame:CGRectMake((320-64)/2,310, 64,64)]; imageView3.image = [UIImage imageNamed:@"player1"]; imageView3.tag = 101; //声明一个可变数组,将一组图片放入 NSMutableArray *imageArray = [[NSMutableArray alloc] init]; for (int i = 1; i <= 12; i++) { NSString *imageName = [NSString stringWithFormat:@"player%d.png",i]; UIImage *currentImage = [UIImage imageNamed:imageName]; [imageArray addObject:currentImage]; } //用于接收一组图片 imageView3.animationImages = imageArray; //设置这组图片播放完成的时长 imageView3.animationDuration = 2.0; [self.window addSubview:imageView3]; //开始图片动画的播放 [imageView3 startAnimating]; //动画停止 //[imageView3 stopAnimating];
- 1
- 2
- 3
- 4
- 5
图片拉伸
UIImage * image = [UIImage imageNamed:@"tab_bar_background"];image = [image resizableImageWithCapInsets:UIEdgeInsetsZero resizingMode:UIImageResizingModeStretch];//图片渲染模式 —原色imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal
阅读全文
0 0
- iOS基石——UIIage
- iOS基石——UIViewController
- iOS基石——UITextField
- iOS基石——UIView
- iOS基石——NSTimer
- iOS基石—— 传值
- iOS基石 —— CALayer
- iOS基石——常用的SDK框架
- iOS基石 —— 不常用的基础控件
- 物理学基石 —— 电
- 物理学基石 —— 麦克斯韦方程组
- 计算机网络基石 —— 集线器
- 网络基石 —— ADSL
- 网络基石 —— 电话线
- iOS基石(一)
- iOS基石(零) - 准备
- 意识——成长的基石
- 物理学基石 —— 波、电磁波、微波
- 双重检查加锁
- chapter01
- Kotlin简明学习,infix函数
- Qt隐藏的功能和技巧
- Yarn-cluster 与 Yarn-client的区别
- iOS基石——UIIage
- Execution failed for task ':app:transformNative_libsWithStripDebugSymbolForRelease'.
- wait() 和 sleep()
- 20170627-BTC、ETH、LTC暴躁高盛大摩看空,仍有业内人士很乐观
- Retrofit新手常用注解
- AS之Findbugs
- 普通的程序员与优秀的程序员的一些差别:
- JS常用代码大全
- php 笔记 (早前的,很乱)