使用Button自带的titleLabel和imageView,用来设置label和image的排列方式
titleEdgeInsets是titleLabel相对于其上下左右的inset,跟tableView的contentInset是类似的;
- 如果只有title,那titleLabel的 上下左右 都是 相对于Button 的;
- 如果只有image,那imageView的 上下左右 都是 相对于Button 的;
- 如果同时有image和label,那image的 上下左 是 相对于Button 的,右 是 相对于label 的;label的 上下右 是 相对于Button的, 左 是 相对于label 的。
.h文件代码定义
|
|
.m实现
|
|