Aucune description

PindanDetailHeaderView.m 1.6KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. //
  2. // PindanDetailself.m
  3. // FirstLink
  4. //
  5. // Created by jack on 15/6/28.
  6. // Copyright (c) 2015年 FirstLink. All rights reserved.
  7. //
  8. #import "PindanDetailHeaderView.h"
  9. @implementation PindanDetailHeaderView
  10. - (instancetype)initWithFrame:(CGRect)frame
  11. {
  12. self = [super initWithFrame:frame];
  13. if (self) {
  14. [self initializeLayout];
  15. }
  16. return self;
  17. }
  18. - (void)initializeLayout
  19. {
  20. UIView *leftLine = [[UIView alloc]init];
  21. UIView *rightLine = [[UIView alloc]init];
  22. self.backgroundColor = [UIColor whiteColor];
  23. leftLine.backgroundColor = UIColorFromRGB(0xe5e5e5);
  24. rightLine.backgroundColor = UIColorFromRGB(0xe5e5e5);
  25. UILabel *titleLabel = ({
  26. UILabel *label = [[UILabel alloc]init];
  27. label.backgroundColor = [UIColor clearColor];
  28. label.text = @"商品详情";
  29. label.textColor = UIColorFromRGB(0x333333);
  30. label.font = [UIFont systemFontOfSize:14];
  31. label;
  32. });
  33. [self addSubview:leftLine];
  34. [self addSubview:rightLine];
  35. [self addSubview:titleLabel];
  36. [titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
  37. make.center.equalTo(self);
  38. }];
  39. [leftLine mas_makeConstraints:^(MASConstraintMaker *make) {
  40. make.centerY.equalTo(self);
  41. make.right.equalTo(titleLabel.mas_left).offset(- 8);
  42. make.height.equalTo(@0.5);
  43. make.width.equalTo(@110);
  44. }];
  45. [rightLine mas_makeConstraints:^(MASConstraintMaker *make) {
  46. make.left.equalTo(titleLabel.mas_right).offset(8);
  47. make.centerY.equalTo(self);
  48. make.width.equalTo(@110);
  49. make.height.equalTo(@0.5);
  50. }];
  51. }
  52. @end