iOS 自定义UIButton的title和image位置
来源:互联网 发布:站长之家源码 编辑:程序博客网 时间:2024/05/29 13:22
做项目需要,所以找了方法,与大家分享~ 亲测可用,contentRect就是我们给UIButton设置的frame值~
张洋给的自定义UIButton的title和image位置的方法:
1.继承自UIButton
2.重写这两个方法:
-(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);}-(CGRect)imageRectForContentRect:(CGRect)contentRect{ CGFloat imageW = CGRectGetWidth(contentRect); CGFloat imageH = contentRect.size.height * 0.6; return CGRectMake(0, 0, imageW, imageH);}
0 0
- iOS 自定义UIButton的title和image位置
- iOS自定义UIButton的Image和Title位置
- 自定义UIButton的title和image位置
- [iOS]详解调整UIButton的title和image的位置
- iOS-调整UIButton的title和image的位置
- UIButton 的 image 和title 位置设置
- UIButton 调整title和image的位置
- 详解调整UIButton的title和image的位置
- UIButton上image和title的位置调整
- UIButton通过UIEdgeInsetsMake设置image和title的位置
- 设置UIButton的image title 位置
- [iOS]UIButton同时添加image和title后子视图位置管理
- UIButton的Image和Title的布局
- UIButton的Image和Title的布局
- UIButton将title和image放置在任意位置上
- iOS UIButton同时设置title和image属性
- iOS UIButton同时设置title和image属性
- button中image和title的位置
- 括号配对问题
- linux的setjmp函数和longjmp函数
- Caffe图片特征提取(Python/C++)
- ASP.NET的路由系统:根据路由规则生成URL
- 求教 oracle sql 能不能在条件为空时查询全部数据??纯sql写 谢谢
- iOS 自定义UIButton的title和image位置
- Xcode裁剪图片
- 公平锁与非公平锁
- 通过上传的APK文件,解析APK文件内容,获取应用权限包名等
- 初探Ajax
- c++函数模板
- ASP.NET MVC路由扩展:路由映射
- 创业的哪些事
- java自动拆装箱总结