No Description

KXUpDownButton.m 1.3KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. //
  2. // KXUpDownButton.m
  3. // CAISHEN
  4. //
  5. // Created by kuxuan on 2017/8/28.
  6. // Copyright © 2017年 kuxuan. All rights reserved.
  7. //
  8. #import "KXUpDownButton.h"
  9. @implementation KXUpDownButton
  10. - (instancetype)initWithFrame:(CGRect)frame
  11. {
  12. if (self = [super initWithFrame:frame]) {
  13. self.backgroundColor = [UIColor whiteColor];
  14. [self setupUI];
  15. }
  16. return self;
  17. }
  18. - (void)setupUI
  19. {
  20. self.titleLabel = [[UILabel alloc]init];
  21. self.titleLabel.text = @"查看更多";
  22. self.titleLabel.textColor = [UIColor titleColor];
  23. self.titleLabel.font = FONT_SYS(14);
  24. self.titleLabel.textAlignment = NSTextAlignmentRight;
  25. [self addSubview:self.titleLabel];
  26. self.imageView = [[UIImageView alloc]init];
  27. self.imageView.image = [UIImage imageNamed:@"main_detail_down"];
  28. [self addSubview:self.imageView];
  29. [self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
  30. make.top.equalTo(self.mas_top).offset(15);
  31. make.centerX.equalTo(self.mas_centerX);
  32. }];
  33. [self.imageView mas_makeConstraints:^(MASConstraintMaker *make) {
  34. make.left.equalTo(self.titleLabel.mas_right).offset(1);
  35. make.centerY.equalTo(self.titleLabel.mas_centerY);
  36. make.size.equalTo(CGSizeMake(10, 6));
  37. }];
  38. }
  39. @end