UIImageView图片视图的基本概念和使用方法
IOS学习笔记(十)之UIImageView图片视图的基本概念和使用方法(博客地址: http://blog.csdn.net/developer_jiangqq )
Author:hmjiangqq
Email:jiangqqlmj@163.com
UIImageView:
作用:专门用于显示图片
首先看下官方的解说:
An image view object provides a view-based container for displaying either a single image or for animating a series of images. For animating the images, the UIImageView
class provides controls to set the duration and frequency of the animation. You can also start and stop the animation freely.
When a UIImageView
object displays one of its images, the actual behavior is based on the properties of the image and the view. If either of the image’s leftCapWidth
or topCapHeight
properties are non-zero, then the image is stretched according to the values in those properties. Otherwise, the image is scaled, sized to fit, or positioned in the image view according to the contentMode
property of the view. It is recommended (but not required) that you use images that are all the same size. If the images are different sizes, each will be adjusted to fit separately based on that mode.
All images associated with a UIImageView
object should use the same scale
. If your application uses images with different scales, they may render incorrectly.
常用属性和方法:
实例代码:
//创建图片视图
UIImageView *imageview=[[UIImageView alloc]initWithFrame:CGRectMake(140, 100, 45, 45)];
//设置高亮
imageview.highlighted=YES;
//设置图片
imageview.image=[UIImage imageNamed:@"notification_icon"];
//设置高亮图片
imageview.highlightedImage=[UIImage imageNamed:@"notification_icon"];
[self.window addSubview:imageview];
- (id)initWithImage:(UIImage *)image; //初始化一张图片 - (id)initWithImage:(UIImage *)image highlightedImage:(UIImage *)highlightedImage NS_AVAILABLE_IOS(3_0); //初始化 加入一张高亮图片与本身图片 //默认图片 @property(nonatomic,retain) UIImage *image; // default is nil //高亮图片 @property(nonatomic,retain) UIImage *highlightedImage NS_AVAILABLE_IOS(3_0); // default is nil @property(nonatomic,getter=isUserInteractionEnabled) BOOL userInteractionEnabled; // default is NO //设置为YES 用户才可以进行点击 //设置为YES 图片高亮显示 @property(nonatomic,getter=isHighlighted) BOOL highlighted NS_AVAILABLE_IOS(3_0); // default is NO
UIImageView图片视图的基本概念和使用方法的更多相关文章
- iOS:UIImageView图像视图控件
UIImageView:图像视图控件: 它是UIView的子类,因此也是视图控件,可以用来显示图像.因为它具有帧动画属性和操作方法,因此可以用来制作动画,其实动画就是很短的时间内,执行显示连续的 ...
- Android——滚动视图(ScrollView)图片视图(ImageView)、状态开关按钮(ToggleButton)、时钟
xml <?xml version="1.0" encoding="utf-8"?> <!--滚动视图--> <ScrollVie ...
- php如何防止图片盗用/盗链的两种方法(转)
图片防盗链有什么用? 防止其它网站盗用你的图片,浪费你宝贵的流量.本文章向大家介绍php防止图片盗用/盗链的两种方法 Apache图片重定向方法 设置images目录不充许http访问 Apache服 ...
- php如何防止图片盗用/盗链的两种方法
如今的互联网,采集网站非常多,很多网站都喜欢盗链/盗用别人网站的图片,这样不仅侵犯网权,还导致被盗链的网站消耗大量的流量,给服务器造成比较大的压力,本文章向大家介绍php如何防止图片盗用/盗链的两种方 ...
- 图片懒加载插件lazyload使用方法
图片懒加载插件lazyload使用方法 一.如何使用: Lazy Load 依赖于 jQuery.引入文件 <script type="text/javascript" sr ...
- MVC中视图View向控制器传值的方法
MVC中视图View向控制器传值的方法步骤如下: 1.index页面: 页面中只需要一个触发事件的按钮
- AWS Python SDK boto3中的基本概念与使用方法
最近在用boto3编写AWS的lamda函数,学习到了boto3中的一些基本概念与使用方法.在此进行总结. 1. boto3提供了两个级别的接口来访问AWS服务:High Level的Resource ...
- ASP图片格式与base64数据互转方法
ASP图片格式与base64数据相互转换的方法,经常用于处理表单中存储有base64字符串格式的图片. 获取到base64数据,转换成图片 <% Subfolder=year(now)& ...
- <转载>CSS解决图片过大撑破DIV的方法
DIV+CSS网页内容中如果插入大于DIV层宽度显示,过大的图片将会撑破网页宽度显示从而网页严重变形,您是否遇到过?这里DIVCSS5给大家介绍几种解决图片撑破撑开网页DIV层方法. 图片撑破宽度解决 ...
随机推荐
- 关于继承UITableViewController若干问题
// // MSHomeCommentTableViewController.m // xiaoqu-ios // // Created by Charlie on 15/7/1. // Copyri ...
- tiny4412学习笔记-将uboot、zImage、文件系统烧到emmc中
1.首先还是要将u-boot写入SD卡中从SD卡启动. 使用读卡器将SD插入电脑中,使用umount卸载u盘, fdisk -l显示其挂载点为 /dev/sdb1 切换到/home/bunfly/im ...
- Oracle查看和修改连接数(进程/会话/并发等等)
查询数据库当前进程的连接数及会话的连接数.并发连接数以及会话情况等等,感兴趣的你可以参考下哈,希望可以帮助到你 1.查询数据库当前进程的连接数: 复制代码 代码如下: select count(* ...
- Kill 正在执行的存储过程
1.找到正在执行的存储过程的 sid ,serial# select b.sid,b.SERIAL#,a.OBJECT, 'alter system kill session ' || ''' ...
- setPluginsEnabled(true) 谁知道android的4.3之后为什么会报错
我也是最近才遇到这个问题的,查了下资料,setPluginEnable已经弃用了,使用webSettings.setPluginState(WebSettings.PluginState.ON);可以 ...
- Nginx和Nginx+的比较(上)
Nginx和Nginx+的比较(上) 作者:chszs,未经博主允许不得转载.经许可的转载需注明作者和博客主页:http://blog.csdn.net/chszs 一.Nginx+介绍 Nginx和 ...
- hdu2222之AC自动机入门
Keywords Search Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) ...
- hdu 2850 Load Balancing (优先队列 + 贪心)
题目大意: 怎么分配n个任务到m个server上使得负载尽量平衡. 思路: 将任务从大到小排序,依次放入负载最小的那个server中. 由于是spj 的缘故,所以能够使用这个贪心. 比方数据 6 2 ...
- jvm的内存管理【转】
[转]JVM内存管理 这些日子一直在研究jvm内存管理的东西,网上的知识很多,总结一下,能沉淀下来的就是自己的! 首先,刚学java的时候就知道java类文件是以 .java为后缀的文件,经过java ...
- CSS中的 REM PX EM
px像素(Pixel).相对长度单位.像素px是相对于显示器屏幕分辨率而言的 em是相对长度单位.相对于当前对象内文本的字体尺寸.如当前对行内文本的字体尺寸未被人为设置,则相对于浏览器的默认字体尺寸. ...