No Description

KXSelectTableViewCell.m 1.6KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. //
  2. // KXSelectTableViewCell.m
  3. // QBCS
  4. //
  5. // Created by kuxuan on 2017/6/9.
  6. // Copyright © 2017年 kuxuan. All rights reserved.
  7. //
  8. #import "KXSelectTableViewCell.h"
  9. @implementation KXSelectTableViewCell
  10. {
  11. UIButton *_contentButton;
  12. }
  13. -(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
  14. {
  15. if (self==[super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
  16. [self setupUI];
  17. }
  18. return self;
  19. }
  20. -(void)setupUI
  21. {
  22. self.contentView.backgroundColor = [UIColor KXColorWithRed:237 green:236 blue:239];
  23. _contentButton=[UIButton buttonWithType:UIButtonTypeCustom];
  24. _contentButton.userInteractionEnabled=NO;
  25. _contentButton.frame=CGRectMake(0, 0, SCREEN_WIDTH, 44);
  26. [_contentButton setTitleColor:[UIColor KXColorWithHex:0x666666] forState:UIControlStateNormal];
  27. [_contentButton setTitleColor:[UIColor baseColor] forState:UIControlStateHighlighted];
  28. _contentButton.titleLabel.font=[UIFont systemFontOfSize:14];
  29. [self.contentView addSubview:_contentButton];
  30. // UILabel *lineLabel=[[UILabel alloc]initWithFrame:CGRectMake(0, 43, SCREEN_WIDTH, 1)];
  31. // lineLabel.backgroundColor=[UIColor lineColor];
  32. // [self.contentView addSubview:lineLabel];
  33. }
  34. -(void)setDetailStr:(NSString *)detailStr
  35. {
  36. _detailStr=detailStr;
  37. [_contentButton setTitle:detailStr forState:UIControlStateNormal];
  38. }
  39. - (void)setIsSelect:(BOOL)isSelect{
  40. _isSelect = isSelect;
  41. isSelect == YES?[_contentButton setTitleColor:[UIColor baseColor] forState:UIControlStateNormal]:[_contentButton setTitleColor:[UIColor KXColorWithHex:0x666666] forState:UIControlStateNormal];
  42. }
  43. @end