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的更多相关文章

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

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

  2. UIButton、UIImageView、UILabel的选择

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

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

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

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

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

  5. IOS中UIButton和UIImageView的区别

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

  6. UIButton和UIImageView的区别

    1.显示图片 1> UIImageView只能一种图片(图片默认会填充整个UIImageView)  image\setImage: 2> UIButton能显示2种图片 * 背景 (背景 ...

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

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

  8. iOS基础 - UIButton - UIImageView

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

  9. iOS - UIButton

    前言 NS_CLASS_AVAILABLE_IOS(2_0) @interface UIButton : UIControl <NSCoding> @available(iOS 2.0, ...

随机推荐

  1. iOS上机题(附个人见解)

    ##机试题目如下 用命令行创建一个以CocoaPods管理的项目[Test-你的姓名拼音],新建3个ViewController,完成以下题目 将下面的问题在一个UITabView里面列出所有问题,单 ...

  2. 安徽省2016“京胜杯”程序设计大赛_B_阵前第一功

    阵前第一功 Time Limit: 1000 MS Memory Limit: 65536 KB Total Submissions: 63 Accepted: 29 Description A国每个 ...

  3. linux下U盘挂载

    linux下挂载U盘 一.Linux挂载U盘:1.插入u盘到计算机,如果目前只插入了一个u盘而且你的硬盘不是scsi的硬盘接口的话,那它的硬件名称为:sda1,可以用"fdisk -l&qu ...

  4. SELECT中的if_case流程函数

    DQL中常用的流程函数if_case ---流程函数在一个SQL语句中实现条件选择 模拟对职员薪水进行分类: mysql> create table salary_tab(userid ,)); ...

  5. 14. Longest Common Prefix【leetcode】

    14. Longest Common Prefix Write a function to find the longest common prefix string amongst an array ...

  6. python 字符串 string

    字符串 string 语法: a = 'hello world!' b = "hello world!" 常用操作: 1.乘法操作是将字符串重复输出2遍 >>> ...

  7. python爬虫url带中文解决方案之一

    import urllib2 urllib2.quote("呵呵哒") #输出 '%BA%C7%BA%C7%DF%D5'

  8. asp.net core 运用 Redis 配置步骤

    Redis可以用来存储session或直接存储键值对 首先要有asp.net core的项目,可以是webapi 或者MVC项目,还有有本地的Redis或者在远程服务器上,具体的安装就不讲述了 以下是 ...

  9. WPF控制动画开始、停止、暂停和恢复

    1.闲言 好久也没更新一博客了,自己有点发懒,同时确实这几个月来也有点忙.风机监测软件,项目中,有这样一个小需求:正常风机在旋转的时候,上位机软要做一个风机的图片,让它不停地旋转,一但检测到下面风机停 ...

  10. Webstorm 提示 Can't use Subversion command line client

    Webstorm 提示 Can't use Subversion command line client Webstorm 提示 Can't use Subversion command line c ...