自定义一个UIButton
2015-08-25 19:16
555 查看
#import "TabBarButton.h" @implementation TabBarButton - (CGRect)imageRectForContentRect:(CGRect)contentRect { CGFloat imageW = contentRect.size.width; CGFloat imageH = contentRect.size.height * 0.6; //按钮图标占据内容的比例为0.6 return CGRectMake(0, 0, imageW, imageH); } - (CGRect)titleRectForContentRect:(CGRect)contentRect { CGFloat titleY = contentRect.size.height * 0.6; CGFloat titleW = contentRect.size.width; CGFloat titleH = contentRect.size.height - titleY; return CGRectMake(0, titleY, titleW, titleH); } @end
相关文章推荐
- GUI编程笔记(java)01:GUI和CLI
- KVO(NSKeyValueObserving )KVC(NSKeyValueCoding)
- HDU 1047.Integer Inquiry【多个大数相加】【高精度】【8月25】
- 45.UIAlertController和常见传值
- 【学习总结】IOS程序运行过程 、UIWindow 、controller 、 UIView 创建过程的总结
- Buildings
- UIImageView 获取图片的 宽 高
- UVA 1151 Buy or Build (最小生成树)
- UE4渲染概述
- UITableView之下拉刷新上拉加载
- iOS基础-高级视图-UITableView--实例:QQ好友列表
- UIPickView
- hdu4219-Buildings(2012chengdu online I题)(贪心)
- 快速排序-QuickSort
- UIAlertController KVO
- Android UI设计——ListView控件与SimpleAdapter适配器(三)
- 【Material Design视觉设计语言】UI组件设计(一):按钮
- leetcode:Permutation Sequence
- 【傻傻分不清楚】四 Request.Form 和 Request.QueryString
- UIActionViewController 详解 iOS8