// // MJIMGUpTextDownBtn.m // weizhuMerchant // // Created by mac on 2019/7/17. // Copyright © 2019 mac. All rights reserved. // #import "MJIMGUpTextDownBtn.h" #import "UIView+LK.h" @implementation MJIMGUpTextDownBtn - (void)setup { self.titleLabel.textAlignment = NSTextAlignmentCenter; self.titleLabel.font = [UIFont systemFontOfSize:15]; //[self setTitle:@"blackColor" forState:UIControlStateNormal]; [self setTitleColor:[UIColor blackColor] forState:UIControlStateNormal]; // self.imageView.backgroundColor=[UIColor orangeColor]; // self.backgroundColor=[UIColor greenColor]; // self.imageView.layer.cornerRadius=5; // self.imageView.layer.masksToBounds=YES; // [self setBackgroundImage:[UIImage imageNamed:@"mainCellBackground"] forState:UIControlStateNormal]; } - (instancetype)initWithFrame:(CGRect)frame { if (self = [super initWithFrame:frame]) { self.contentMode=UIViewContentModeScaleAspectFit; [self setup]; } return self; } - (void)awakeFromNib { [super awakeFromNib]; [self setup]; } - (void)layoutSubviews { [super layoutSubviews]; self.imageView.xmg_y = 0; self.imageView.xmg_width = self.xmg_width*0.3 ; self.imageView.xmg_height = self.xmg_width*0.3; self.imageView.xmg_centerX = self.xmg_width * 0.5; // self.imageView.xmg_centerY = self.xmg_width * 0.5; self.titleLabel.xmg_x = 0; self.titleLabel.xmg_y = CGRectGetMaxY(self.imageView.frame)+5; self.titleLabel.xmg_width = self.xmg_width; self.titleLabel.xmg_height = self.xmg_height - self.titleLabel.xmg_y; } @end