Aucune description

KXEventTopView.m 1.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. //
  2. // KXEventTopView.m
  3. // CAISHEN
  4. //
  5. // Created by jikaipeng on 2017/8/24.
  6. // Copyright © 2017年 kuxuan. All rights reserved.
  7. //
  8. #import "KXEventTopView.h"
  9. @interface KXEventTopView ()
  10. @end
  11. @implementation KXEventTopView
  12. - (instancetype)initWithFrame:(CGRect)frame{
  13. if (self = [super initWithFrame:frame]) {
  14. [self addSubview:self.imageview];
  15. [self addSubview:self.titleLabel];
  16. [self addSubview:self.detaileLabel];
  17. [self addConstraint];
  18. }
  19. return self;
  20. }
  21. - (void)addConstraint{
  22. [self.imageview mas_makeConstraints:^(MASConstraintMaker *make) {
  23. make.left.equalTo(self.mas_left).offset(16*SCREEN_MUTI);
  24. make.size.equalTo(CGSizeMake(50*SCREEN_MUTI, 42*SCREEN_MUTI));
  25. make.centerY.equalTo(self.mas_centerY);
  26. }];
  27. [self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
  28. make.top.equalTo(self.imageview.mas_top);
  29. make.left.equalTo(self.imageview.mas_right).offset(16);
  30. }];
  31. [self.detaileLabel mas_makeConstraints:^(MASConstraintMaker *make) {
  32. make.left.equalTo(self.titleLabel.mas_left);
  33. make.bottom.equalTo(self.imageview.mas_bottom);
  34. }];
  35. }
  36. - (UIImageView *)imageview{
  37. if (!_imageview) {
  38. _imageview = [[UIImageView alloc] init];
  39. }
  40. return _imageview;
  41. }
  42. - (UILabel *)titleLabel{
  43. if (!_titleLabel) {
  44. _titleLabel = [[UILabel alloc]init];
  45. _titleLabel.font = FONT_SYS(16);
  46. _titleLabel.textColor = [UIColor titleColor];
  47. }
  48. return _titleLabel;
  49. }
  50. - (UILabel *)detaileLabel{
  51. if (!_detaileLabel) {
  52. _detaileLabel = [[UILabel alloc] init];
  53. _detaileLabel.font = FONT_SYS(12);
  54. _detaileLabel.textColor = [UIColor KXColorWithHex:0x666666];
  55. }
  56. return _detaileLabel;
  57. }
  58. @end