12345678910111213141516171819202122232425262728293031323334353637383940 |
- //
- // MyButton.m
- // 振飞商城
- //
- // Created by 123 on 2020/5/25.
- // Copyright © 2020 Vibration Fly. All rights reserved.
- //
- #import "MyButton.h"
- #import "UIView+LK.h"
-
- @implementation MyButton
- -(instancetype)initWithFrame:(CGRect)frame{
- if (self=[super initWithFrame:frame]) {
-
- // [self setTitleColor:kRGBColor51 forState:UIControlStateNormal];
- self.titleLabel.font= [UIFont systemFontOfSize:12 weight:UIFontWeightMedium];
-
- }
-
- return self;
- }
- - (void)layoutSubviews{
-
- [super layoutSubviews];
-
-
- self.imageView.xmg_y=10;
- self.imageView.xmg_x=(self.xmg_width-self.imageView.xmg_width)/2;
- self.titleLabel.xmg_y=CGRectGetMaxY(self.imageView.frame)+5;
- self.titleLabel.xmg_width=self.xmg_width;
- self.titleLabel.xmg_x=0;
- //self.contentHorizontalAlignment = UIControlContentHorizontalAlignmentCenter;
- self.titleLabel.textAlignment=NSTextAlignmentCenter;
-
-
- }
- @end
|