// // ButtonView.m // jiaPei // // Created by apple on 16/8/15. // Copyright © 2016年 JCZ. All rights reserved. // #import "ButtonView.h" @implementation ButtonView -(id)initWithFrame:(CGRect)frame Image:(NSString *)aImg Title:(NSString *)aTitle Detail:(NSString *)aDetail type:(NSInteger)aType { self = [super initWithFrame:frame]; if (self) { self.backgroundColor = backGroundColor; [self setBoardWid:1 Color:backGroundColor]; CGFloat wid = frame.size.width; CGFloat x,y,w,h; w = h = 25; x = (wid *2.0/7.0 - w)/2.0; y = 10; _imgView = [[UIImageView alloc] setxywh]; _imgView.image = [UIImage imageNamed:aImg]; [self addSubview:_imgView]; if (aType == 1) { x = wid *2.0/7.0; w = wid - x - 1; h = 20; _titleLabel = [[UILabel alloc] setxywh]; [_titleLabel setText:aTitle Font:16 TextColor:kTitleColor]; [self addSubview:_titleLabel]; y += h + 5; h = 20; _detailLabel = [[UILabel alloc] setxywh]; [_detailLabel setText:aDetail Font:14 TextColor:contentTextColor]; _detailLabel.adjustsFontSizeToFitWidth = YES; _detailLabel.minimumScaleFactor = 0.9; [self addSubview:_detailLabel]; } if (aType == 2) { x = wid *2.0/7.0; w = wid - x - 1; h = 25; _titleLabel = [[UILabel alloc] setxywh]; [_titleLabel setText:aTitle Font:16 TextColor:kTitleColor]; [self addSubview:_titleLabel]; } } return self; } @end