// // GDButton.m // jiaPei // // Created by apple on 15/11/20. // Copyright (c) 2015年 JCZ. All rights reserved. // #import "GDButton.h" @implementation GDButton { UILabel* subTitle; } -(instancetype)initWithFrame:(CGRect)frame { self = [super initWithFrame:frame]; if (self) { [self setTitleColor:kTitleColor forState:UIControlStateNormal]; [self.imageView setContentMode:UIViewContentModeScaleAspectFit]; [self.titleLabel setTextAlignment:NSTextAlignmentLeft]; subTitle = [[UILabel alloc] init]; [subTitle setFont:[UIFont scaleSize:13]]; [subTitle setTextColor:contentTextColor]; [self addSubview:subTitle]; } return self; } -(void)setDetailText:(NSString*)str { CGFloat hei = self.frame.size.height; CGFloat wid = self.frame.size.width; [subTitle setFrame:CGRectMake( wid*.1, hei*.5, wid*.6, hei*.4)]; [subTitle setText:str]; } -(CGRect)imageRectForContentRect:(CGRect)contentRect { CGFloat hei = self.frame.size.height; CGFloat wid = self.frame.size.width; return CGRectMake(wid*.75,hei*.1,wid*.15,hei*.8); } -(CGRect)titleRectForContentRect:(CGRect)contentRect { CGFloat hei = self.frame.size.height; CGFloat wid = self.frame.size.width; return CGRectMake( wid*.1, hei*.1, wid*.6, hei*.4); } @end /* wid . hei left_bd = wid*.1 right_bd =wid*.1 top_bd = hei*.1 bot_bd = hei*.1 lblw = wid*.6 imgw = wid*.3 lblh = hei*.4 imgh = hei*.8 **/