1.显示图片

1> UIImageView只能一种图片(图片默认会填充整个UIImageView)  image\setImage:

2> UIButton能显示2种图片

* 背景 (背景会填充整个UIButton)  setBackroungImage:forState:

* 前置(覆盖在背景上面的图片,按照之前的尺寸显示)  setImage:forState:

* 还能显示文字

2.点击事件

1> UIImageView默认是不能响应点击事件

2> UIButton能响应点击事件 : addTarget:action:forControlEvents:

3.使用场合

1> UIImageView : 只显示图片,不监听点击,点击了图片后不做任何反应

2> UIButton : 既显示图片,又监听点击,点击了图片后做一些其他事情

4.继承结构

1> UIButton之所以能添加监听器来监听事件,是因为它继承自UIControl

 
 2> UIImagevIew之所以不能添加监听器来监听事件,是因为它直接继承自UIView 
 
参考资料:百度搜索

UIButton和UIImageView的区别的更多相关文章

  1. IOS中UIButton和UIImageView的区别

    1.使用场合 UIImageView:如果仅仅是为了显示图片,不需要监听图片的点击事件 UIButton:既要显示图片,又要监听图片等点击事件 2.相同点 都能显示图片 3.不同点 UIButton能 ...

  2. IOS开发学习笔记024-UIButton和UIImageView的区别

    一.UIButton和UIImageView的区别 1. UIImageView 默认只能显示一张图片(默认会填充整个ImageView) 设置方法:image/setImage: UIButton ...

  3. iOS开发——UI基础-UIButton、UIImageView、UILabel的选择

    1.UILabel - UILabel的常见属性 @property(nonatomic,copy) NSString *text; 显示的文字 @property(nonatomic,retain) ...

  4. UIButton、UIImageView、UILabel的选择

    UIButton特点既能显示文字,又能显示图片(能显示2张图片,背景图片.内容图片)长按高亮的时候可以切换图片\文字直接通过addTarget...方法监听点击 UIImageView能显示图片,不能 ...

  5. ##DAY2 UILabel、UITextField、UIButton、UIImageView、UISlider

    ##DAY2 UILabel.UITextField.UIButton.UIImageView.UISlider #pragma mark ———————UILabel——————————— UILa ...

  6. UITextFiled,UIButton,UIImageView交互相互之间的事件拦截

    UIButton右上方添加一个笑button如: UIButton *button =[UIButton buttonWithType:UIButtonTypeCustom];    button.f ...

  7. UIButton和UIimageView

    1.按钮控件使用的类是UIButton 点击按钮会触发某个事件 2.按钮控件的初始化 UIButton *button = [UIButton buttonWithType:UIButtonTypeC ...

  8. uicollectionview 使用uibutton或者uiimageview实现旋转出现scale的问题

    uicollectionview下单独使用uibutton然后setimage或者直接使用uiimageview然后一定角度旋转后发现size会变动 解决方案:添加uibutton到uicollect ...

  9. iOS基础 - UIButton - UIImageView

    封装思想:将相同的重复东西保存到方法里,不同的东西用参数代替.不相同的东西交给方法调用者,相同东西自己搞定. 一.UIButton和UIImageView的区别 1.显示图片 1> UIImag ...

随机推荐

  1. php连接mysql的一些方法总结

    为了能让PHP连接MSSQL,系统需要安装MSSQL,PHP,且在PHP.ini中的配置中,将       ;extension=php_mssql.dll前面的;去掉 1.连接MSSQL       ...

  2. C#操作iframe

    <iframe id="cl" name="clf" src="xianshi.aspx" runat="server&qu ...

  3. Objective-C中instancetype和id的区别

    要区分instancetype和id,首先要弄清楚什么是关联返回类型(Related Result Type). 关联返回类型即一个方法的返回类型就是调用这个方法的调用者的类型.具有下列条件的方法具有 ...

  4. CSS应用五

    1. 页面变灰 html {   filter: grayscale(100%);//IE浏览器   -webkit-filter: grayscale(100%);//谷歌浏览器   -moz-fi ...

  5. c# 与 c++ 编译

    C#的所有方法封装在类中,类的方法没有先后之分,无需声明.//而C++必须在函数调用前,由编译器检查参数类型是否合法,所以必须知道函数的原形(protype),所以必须提前声明函数的签名(signat ...

  6. GoogLeNet学习心得

    转自:http://blog.csdn.net/liumaolincycle/article/details/50471289#t0 综述: http://blog.csdn.net/sunbaigu ...

  7. zlog使用手册,小靠谱啊

    http://hardysimpson.github.io/zlog/UsersGuide-CN.html Chapter 1 zlog是什么? zlog是一个高可靠性.高性能.线程安全.灵活.概念清 ...

  8. ural 1586. Threeprime Numbers

    这道题看着别人的代码写的. #include <cstdio> #include <cstring> #define m 1000000009 using namespace ...

  9. 华为手机root 删除一般不用软件 的命令

    上个B518海外版的一键root精简 精简了以下这些,不想删除的自己可以在刷机脚本中删除对应行就行了,音量解锁,GPS,搜索键关屏,root,添加钛备份4.0,re管理器,其他框架未改动,稳定性不会变 ...

  10. Bring it on

    I am going to open a whole new English Blog here. Most blogs here would be computer technologies, in ...