猎豆优选

LDDetailHeaderTitle.m 1.3KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. //
  2. // LDDetailHeaderTitle.m
  3. // YouHuiProject
  4. //
  5. // Created by 小花 on 2018/7/10.
  6. // Copyright © 2018年 kuxuan. All rights reserved.
  7. //
  8. #import "LDDetailHeaderTitle.h"
  9. @implementation LDDetailHeaderTitle
  10. - (instancetype)initWithFrame:(CGRect)frame title:(NSString *)text{
  11. self = [super initWithFrame:frame];
  12. if (self) {
  13. self.backgroundColor = [UIColor whiteColor];
  14. UILabel *title = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, Fitsize(65), self.height)];
  15. title.font = [UIFont systemFontOfSize:Fitsize(14)];
  16. title.textColor = [UIColor YHColorWithHex:0x666666];
  17. title.centerX = self.width/2;
  18. title.textAlignment = NSTextAlignmentCenter;
  19. title.text = text;
  20. [self addSubview:title];
  21. UIView *leftLine = [[UIView alloc] initWithFrame:CGRectMake(title.left-60, 0, 50, 1)];
  22. leftLine.backgroundColor = [UIColor YHColorWithHex:0x666666];
  23. leftLine.centerY = self.height/2;
  24. [self addSubview:leftLine];
  25. UIView *rightLine = [[UIView alloc] initWithFrame:CGRectMake(title.right+10, 0, 50, 1)];
  26. rightLine.backgroundColor = [UIColor YHColorWithHex:0x666666];
  27. rightLine.centerY = self.height/2;
  28. [self addSubview:rightLine];
  29. }
  30. return self;
  31. }
  32. @end