自定义一个UIButton

来源:互联网 发布:单片机push 编辑:程序博客网 时间:2024/05/01 06:52
#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

0 0
原创粉丝点击