UIButton和UIimageView
1.按钮控件使用的类是UIButton 点击按钮会触发某个事件
2.按钮控件的初始化
UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom/*自动定制类型*/];
2. frame 设置button的位置信息 如:
button.frame = CGRectMake(100,100,100,100);
3.通过点击button去触发定制的是
[button addTarget:self action:@selector(选择的方法) forControlEvents:UIControlEventTouchUpInside];
4. 向按钮button里设置图片
[button setBackgroundImage:[UIImage imageNamed:@"图片名"] forState:UIControlStateHighlighted];
5.设置button里的字体的颜色
[button setTitleColor:[UIColor greenColor] forState:UIControlStateNormal];
6.showsTouchWhenHighlighted 点击之后成高亮状态
button.showsTouchWhenHighlighted = YES;
7. selected 判断按钮是否被选中
button.selected = NO;
8.给控件取名字
[button setTitle:@"小海" forState:UIControlStateNormal]; 图片视图
1. 使用的类是UIImageView 用来展示图片的
2.初始化图片
UIImageView *imageView = [[UIImageView alloc]initWithFrame:[UIScreen mainScreen].bounds];
3.添加图片
imageView.image = [UIImage imageNamed:@"abc.jpg"];
UIButton和UIimageView的更多相关文章
- iOS开发——UI基础-UIButton、UIImageView、UILabel的选择
1.UILabel - UILabel的常见属性 @property(nonatomic,copy) NSString *text; 显示的文字 @property(nonatomic,retain) ...
- UIButton、UIImageView、UILabel的选择
UIButton特点既能显示文字,又能显示图片(能显示2张图片,背景图片.内容图片)长按高亮的时候可以切换图片\文字直接通过addTarget...方法监听点击 UIImageView能显示图片,不能 ...
- ##DAY2 UILabel、UITextField、UIButton、UIImageView、UISlider
##DAY2 UILabel.UITextField.UIButton.UIImageView.UISlider #pragma mark ———————UILabel——————————— UILa ...
- UITextFiled,UIButton,UIImageView交互相互之间的事件拦截
UIButton右上方添加一个笑button如: UIButton *button =[UIButton buttonWithType:UIButtonTypeCustom]; button.f ...
- IOS中UIButton和UIImageView的区别
1.使用场合 UIImageView:如果仅仅是为了显示图片,不需要监听图片的点击事件 UIButton:既要显示图片,又要监听图片等点击事件 2.相同点 都能显示图片 3.不同点 UIButton能 ...
- UIButton和UIImageView的区别
1.显示图片 1> UIImageView只能一种图片(图片默认会填充整个UIImageView) image\setImage: 2> UIButton能显示2种图片 * 背景 (背景 ...
- uicollectionview 使用uibutton或者uiimageview实现旋转出现scale的问题
uicollectionview下单独使用uibutton然后setimage或者直接使用uiimageview然后一定角度旋转后发现size会变动 解决方案:添加uibutton到uicollect ...
- iOS基础 - UIButton - UIImageView
封装思想:将相同的重复东西保存到方法里,不同的东西用参数代替.不相同的东西交给方法调用者,相同东西自己搞定. 一.UIButton和UIImageView的区别 1.显示图片 1> UIImag ...
- iOS - UIButton
前言 NS_CLASS_AVAILABLE_IOS(2_0) @interface UIButton : UIControl <NSCoding> @available(iOS 2.0, ...
随机推荐
- WAS 部署 Birt 报表出现 error.CannotStartupOSGIPlatform 和 更新web.xml
在WAS7.0中部署Birt报表会出现error.CannotStartupOSGIPlatform错误,通常需要这样修改 1.依次打开Applications->WebSphere enter ...
- 调皮的QQ音乐API:修复无法获取歌单
上一篇完整版:http://www.cnblogs.com/TwilightLemon/p/7076938.html QQ音乐的API真是太调皮了,获取歌单的API又更换了好多次,喵喵喵 旧版API( ...
- 拓扑排序 topsort详解
1.定义 对一个有向无环图G进行拓扑排序,是将G中所有顶点排成一个线性序列,通常,这样的线性序列称为满足拓扑次序(Topological Order)的序列,简称拓扑序列. 举例: h3 { marg ...
- 设计模式(二) 策略模式Strategy
策略模式是对算法的包装,是把使用算法的责任和算法本身分割开来,委派给不同的对象管理,我个人的理解是,具有相同行为不同的行为模式,比如走路,有人速度3m/s,有人100m/s,把他们的具体行走和对象本身 ...
- 为Tornado框架加上基于Redis或Memcached的session 【第三方】
Tornado 没有session,只有cookie_secret,这在一些情况下是不利于开发的.所有我们可以给Tornado加上session的功能. 这篇文章讲解的是依靠第三方包来实现.以后的文章 ...
- WebServices客户端代码生成
方式一: 官网下载cxf运行包:http://cxf.apache.org/download.html axis2:http://axis.apache.org/axis2/java/core/dow ...
- RGB和HSV颜色空间
转载:http://blog.csdn.net/carson2005/article/details/6243892 RGB颜色空间: RGB(red,green,blue)颜色空间最常用的用途就是显 ...
- mysql metadata lock
想必玩过mysql的人对Waiting for table metadata lock肯定不会陌生,一般都是进行alter操作时被堵住了,导致了我们在show processlist 时,看到线程的状 ...
- .Net Core 2.0生态(3):ASP.NET Core 2.0 特性介绍和使用指南
ASP.NET Core 2.0 发布日期:2017年8月14日 ASP.NET团队宣布ASP.NET Core 2.0正式发布,发布Visual Studio 2017 15.3支持ASP.NET ...
- 关于Tomcat无法启动的问题(Server Tomcat v7.0 Server at localhost failed to start.)
我们在使用tomcat时会发生Server Tomcat v7.0 Server at localhost failed to start.即tomcat无法启动的问题,如下图: