口袋优选

CCActionSheetCell.m 1.7KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. //
  2. // CCActionSheetCell.m
  3. // YouHuiProject
  4. //
  5. // Created by 小花 on 2018/1/25.
  6. // Copyright © 2018年 kuxuan. All rights reserved.
  7. //
  8. #import "CCActionSheetCell.h"
  9. #define kWidth [UIScreen mainScreen].bounds.size.width
  10. #define kHeight [UIScreen mainScreen].bounds.size.height
  11. #define ROW_HEIGHT 44
  12. @implementation CCActionSheetCell
  13. - (void)awakeFromNib {
  14. [super awakeFromNib];
  15. // Initialization code
  16. }
  17. - (void)setSelected:(BOOL)selected animated:(BOOL)animated {
  18. [super setSelected:selected animated:animated];
  19. // Configure the view for the selected state
  20. }
  21. - (void)buildUI{
  22. UILabel *titleLab = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, kWidth, ROW_HEIGHT)];
  23. titleLab.textColor = [UIColor blackColor];
  24. titleLab.font = [UIFont systemFontOfSize:15.0];
  25. titleLab.textAlignment = NSTextAlignmentCenter;
  26. titleLab.backgroundColor = [UIColor clearColor];
  27. [self.contentView addSubview:titleLab];
  28. self.actionLabel = titleLab ;
  29. [self.contentView setBackgroundColor:[UIColor colorWithWhite:0.9 alpha:0.5]];
  30. self.actionLabel = titleLab ;
  31. [self.actionLabel setAutoresizingMask:UIViewAutoresizingFlexibleLeftMargin|UIViewAutoresizingFlexibleRightMargin];
  32. }
  33. - (void)setHighlighted:(BOOL)highlighted animated:(BOOL)animated // animate between regular and highlighted state
  34. {
  35. [super setHighlighted:highlighted animated:animated];
  36. if (highlighted) {
  37. [self.actionLabel setBackgroundColor:[UIColor colorWithWhite:0.9 alpha:0.5]];
  38. }else{
  39. [self.actionLabel setBackgroundColor:[UIColor whiteColor]];
  40. }
  41. }
  42. @end