RADetailLocationCell.m 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. //
  2. // RADetailLocationCell.m
  3. // Apex And Drivers
  4. //
  5. // Created by Jack on 2018/6/2.
  6. // Copyright © 2018年 USAI. All rights reserved.
  7. //
  8. #import "RADetailLocationCell.h"
  9. #import "RADetailLocationModel.h"
  10. //#import <MapKit/MapKit.h>
  11. @interface RADetailLocationCell ()
  12. @property (strong, nonatomic) IBOutlet UILabel *titleLabel;
  13. @property (strong, nonatomic) IBOutlet UIButton *navigationBtn;
  14. @property (strong, nonatomic) IBOutlet UITextView *valueLabel;
  15. @end
  16. @implementation RADetailLocationCell
  17. - (void)awakeFromNib {
  18. [super awakeFromNib];
  19. // Initialization code
  20. self.valueLabel.textContainerInset = UIEdgeInsetsMake(0, -5, 0, -5);
  21. }
  22. - (void)setSelected:(BOOL)selected animated:(BOOL)animated {
  23. [super setSelected:selected animated:animated];
  24. // Configure the view for the selected state
  25. }
  26. - (void)prepareForReuse {
  27. [super prepareForReuse];
  28. self.model = nil;
  29. self.delegate = nil;
  30. }
  31. - (void)setModel:(RADetailLocationModel *)model {
  32. _model = model;
  33. self.titleLabel.text = _model.title;
  34. self.valueLabel.text = _model.location;
  35. if (_model.highlight) {
  36. self.valueLabel.textColor = [UIColor redColor];
  37. } else{
  38. self.valueLabel.textColor = [UIColor blackColor];
  39. }
  40. if (model.detectTel) {
  41. self.valueLabel.dataDetectorTypes = UIDataDetectorTypePhoneNumber;
  42. } else {
  43. self.valueLabel.dataDetectorTypes = UIDataDetectorTypeNone;
  44. }
  45. }
  46. #pragma mark - User Action
  47. - (IBAction)navigationBtnClick:(UIButton *)sender {
  48. if (self.delegate && [self.delegate respondsToSelector:@selector(locationCell:didClickNavigation:)]) {
  49. [self.delegate locationCell:self didClickNavigation:self.model];
  50. }
  51. }
  52. @end