button 垂直分布
UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];//button的类型
button.frame = CGRectMake(100, 100,90, 90);//button的frame
button.backgroundColor = [UIColor cyanColor];//button的背景颜色 // [button setBackgroundImage:[UIImage imageNamed:@"man_64.png"] forState:UIControlStateNormal]; // 在UIButton中有三个对EdgeInsets的设置:ContentEdgeInsets、titleEdgeInsets、imageEdgeInsets
[button setImage:[UIImage imageNamed:@"IconHome@2x.png"] forState:UIControlStateNormal];//给button添加image
button.imageEdgeInsets = UIEdgeInsetsMake(5,13,21,button.titleLabel.bounds.size.width);//设置image在button上的位置(上top,左left,下bottom,右right)这里可以写负值,对上写-5,那么image就象上移动5个像素 [button setTitle:@"首页" forState:UIControlStateNormal];//设置button的title
button.titleLabel.font = [UIFont systemFontOfSize:16];//title字体大小
button.titleLabel.textAlignment = NSTextAlignmentCenter;//设置title的字体居中
[button setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];//设置title在一般情况下为白色字体
[button setTitleColor:[UIColor grayColor] forState:UIControlStateHighlighted];//设置title在button被选中情况下为灰色字体
button.titleEdgeInsets = UIEdgeInsetsMake(71, -button.titleLabel.bounds.size.width-50, 0, 0);//设置title在button上的位置(上top,左left,下bottom,右right) // [button setContentEdgeInsets:UIEdgeInsetsMake(70, 0, 0, 0)];// // button.contentHorizontalAlignment = UIControlContentHorizontalAlignmentCenter;//设置button的内容横向居中。。设置content是title和image一起变化 [button addTarget:self action:@selector(tap) forControlEvents:UIControlEventTouchUpInside];
button 垂直分布的更多相关文章
- CorelDRAW中如何分布对象
分布对象功能主要用来控制选择对象之间的距离,可以满足用户对均匀间距的要求,通常用于选择三个或三个以上的物体,将他们之间的距离平均分布.本教程将详解CorelDRAW中关于分布对象的操作. CorelD ...
- android中5大布局
Android布局也可以用HTML5做,但是用户体验性差 Android布局里XML的属性配置 1. 五种Layout中Item的基础属性: layout_width & layout_hei ...
- 【风马一族_Android】第4章Android常用基本控件
第4章Android常用基本控件 控件是Android用户界面中的一个个组成元素,在介绍它们之前,读者必须了解所有控件的父类View(视图),它好比一个盛放控件的容器. 4.1View类概述 对于一个 ...
- android textview字体加粗 Android studio最新水平居中和垂直居中
android textview字体加粗 Android studio最新水平居中和垂直居中 Android中字体加粗在xml文件中使用android:textStyle=”bold”但是不能将中文设 ...
- ASP.NET MVC中商品模块小样
在前面的几篇文章中,已经在控制台和界面实现了属性值的笛卡尔乘积,这是商品模块中的一个难点.本篇就来实现在ASP.NET MVC4下商品模块的一个小样.与本篇相关的文章包括: 1.ASP.NET MVC ...
- Android 之 布局训练
1.线性布局 LinearLayout <?xml version="1.0" encoding="utf-8"?> <LinearLay ...
- android LinearLayout
Android的布局方式共有6种,分别是LinearLayout(线性布局).TableLayout(表格布局).FrameLayout(帧布局).RelativeLayout(相对布局).GridL ...
- 安卓app开发-05-Android xml布局详细介绍
安卓app开发-05-Android xml布局详细介绍 虽然说有 墨刀,墨客 这些图形化开发工具来做 Android 的界面设计,但是我们还是离不开要去学习做安卓原生app,学习 xml 布局还是必 ...
- RelativeLayout与LinearLayout的比较
转自:http://blog.csdn.net/onepiece2/article/details/26396287 RelativeLayout 是相对布局在页面上相对于页面坐标进行布局设置.比如可 ...
随机推荐
- Java NIO使用及原理分析(三)
在上一篇文章中介绍了缓冲区内部对于状态变化的跟踪机制,而对于NIO中缓冲区来说,还有很多的内容值的学习,如缓冲区的分片与数据共享,只读缓冲区等.在本文中我们来看一下缓冲区一些更细节的内容. 缓冲区的分 ...
- Spring Security4源码解读探寻权限机制
我们知道springSecurity 会在用户登录的时候获取用户的角色权限, 你是一个普通用户可能没有管理员拥有的权限.用户登录后Authentication 获取用户的权限. 不通用户登录系统会生成 ...
- 转 python 之 分割参数getopt
python 之 分割参数getopt os下有个方法walk,非常的好用,用来生成一个generator.每次可以得到一个三元tupple,其中第一个为起始路径,第二个为起始路径下的文件夹,第三个是 ...
- SVN工具的使用 和在Eclipse中安装GPD插件:(多步审批流,因此选择使用工作流(JBPM)来实现)
前言 重点解说SVN工具的还原版本号. 1.提交svn之前.要先更新文件.假设更新之后有版本号冲突的话.就线下解决掉冲突,在把该文件标记为已经解决冲突. 正文 使用SVN还原历史版本号 water ...
- JS手动创建标签
代码: <html> <head> <title>js标签属性的添加</title> <script > function setxxx() ...
- WPF Radio组的绑定
都是控件编,RadioButtion 简单绑定使用,model.cs下边定义属性 private int _isSuccess; public int IsSuccess { get { return ...
- Could not parse mapping document from resource cn/spt/model/Student.hbm.xml
初始hibernate, 写第一个程序 helloworld的错误: Exception in thread "main" org.hibernate.InvalidMapping ...
- hibernate逆向工程生成的实体映射需要修改
根据实际情况进行修改,主要2处,注释的位置<!-- 把catalog="platform"删掉 -->,<!-- 替换为native --> <? ...
- Angularjs总结(三)摸态框的使用
静态页面: <input class="btn btnStyle " value="提 取" type="button" ng-cli ...
- CI 笔记 数据库
demo: 1. 建立数据库,driver, 字段 name,telphone,idcard,car,content 2. 建立model,Driver_model.php文件, 建立add方法, ...