SheetViewCell.m 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. //
  2. // SheetViewCellTableViewCell.m
  3. // IBOSSmini
  4. //
  5. // Created by guan hong hou on 2018/3/30.
  6. // Copyright © 2018年 elongtian. All rights reserved.
  7. //
  8. #import "SheetViewCell.h"
  9. @implementation SheetViewCell
  10. - (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
  11. self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
  12. return self;
  13. }
  14. - (void)setInvoiceStyle:(InvoiceStyle *)style{
  15. UIView *invoiceStyleView=[UIView new];
  16. invoiceStyleView.frame=CGRectMake(0,0, Screen_Width,40);
  17. [self addSubview:invoiceStyleView];
  18. NSDictionary *styleDict = @{NSFontAttributeName:kTextFont};
  19. _invoiceStyle=style;
  20. _invoiceStyleLbl = [UILabel new];
  21. _invoiceStyleLbl.textColor = [UIColor blackColor];
  22. _invoiceStyleLbl.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
  23. NSString *invoiceStyle= _invoiceStyle.invoiceStyleName;
  24. if(invoiceStyle!=nil&&invoiceStyle.length>0){
  25. CGRect invoiceStyleFrame = [invoiceStyle textRectWithSize:CGSizeMake(MAXFLOAT, MAXFLOAT) attributes:styleDict];
  26. invoiceStyleFrame.origin.x =Screen_Width/2-invoiceStyleFrame.size.width/2;
  27. invoiceStyleFrame.origin.y =10;
  28. _invoiceStyleLbl.frame=invoiceStyleFrame;
  29. _invoiceStyleLbl.text=invoiceStyle;
  30. }
  31. [invoiceStyleView addSubview:_invoiceStyleLbl];
  32. UIView *bottomSeparatorView = [UIView new];
  33. bottomSeparatorView.frame=CGRectMake(0,40, Screen_Width, 1);
  34. bottomSeparatorView.backgroundColor = LineBackgroundColor;
  35. [invoiceStyleView addSubview:bottomSeparatorView];
  36. }
  37. @end