JXNearMarkCell.m 2.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. //
  2. // JXNearMarkCell.m
  3. // shiku_im
  4. //
  5. // Created by MacZ on 16/8/25.
  6. // Copyright © 2016年 Reese. All rights reserved.
  7. //
  8. #import "JXNearMarkCell.h"
  9. #import "JXMyTools.h"
  10. #import <MapKit/MapKit.h>
  11. @implementation JXNearMarkCell
  12. - (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
  13. self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
  14. if (self) {
  15. _markImgView = [[UIImageView alloc] initWithFrame:CGRectMake(10, 0, 15, 18)];
  16. _markImgView.center = CGPointMake(_markImgView.center.x, NEAERMAEK_CELL_HEIGHT/2);
  17. _markImgView.image = [UIImage imageNamed:@"location_gray"];
  18. [self.contentView addSubview:_markImgView];
  19. // [_markImgView release];
  20. //地址名
  21. _markName = [[UILabel alloc] initWithFrame:CGRectMake(_markImgView.frame.origin.x + _markImgView.frame.size.width + 10, 10, JX_SCREEN_WIDTH - _markImgView.frame.origin.x - _markImgView.frame.size.width - 10 - 30, 15)];
  22. _markName.font = [UIFont boldSystemFontOfSize:15];
  23. [self.contentView addSubview:_markName];
  24. // [_markName release];
  25. // _markName.backgroundColor = [UIColor cyanColor];
  26. //地址位置
  27. _markPlace = [[UILabel alloc] initWithFrame:CGRectMake(_markName.frame.origin.x, _markName.frame.origin.y + _markName.frame.size.height + 5, _markName.frame.size.width, 12)];
  28. _markPlace.font = SYSFONT(14);
  29. [self.contentView addSubview:_markPlace];
  30. // [_markPlace release];
  31. // _markPlace.backgroundColor = [UIColor cyanColor];
  32. //选中标志
  33. _selFlag = [[UIImageView alloc] initWithFrame:CGRectMake(JX_SCREEN_WIDTH - 30-15, 10, 30, 30)];
  34. _selFlag.image = [UIImage imageNamed:@"ic_has_input"];
  35. _selFlag.hidden = YES;
  36. [self.contentView addSubview:_selFlag];
  37. // [_selFlag release];
  38. // _selFlag.backgroundColor = [UIColor magentaColor];
  39. //下划线
  40. UIView *bottomLine = [JXMyTools bottomLineWithFrame:CGRectMake(8, NEAERMAEK_CELL_HEIGHT - LINE_WH, JX_SCREEN_WIDTH - 8*2, LINE_WH)];
  41. [self.contentView addSubview:bottomLine];
  42. // [bottomLine release];
  43. self.selectionStyle = UITableViewCellSelectionStyleNone;
  44. }
  45. return self;
  46. }
  47. - (void)setSelected:(BOOL)selected {
  48. if (selected) {
  49. self.selFlag.hidden = NO;
  50. }else {
  51. self.selFlag.hidden = YES;
  52. }
  53. }
  54. - (void)refreshWith:(MKMapItem *)item{
  55. _markName.text = item.name;
  56. _markPlace.text = item.placemark.thoroughfare;
  57. }
  58. - (void)refreshWithModel:(JXPlaceMarkModel *)model{
  59. _markName.text = model.placeName;
  60. _markPlace.text = model.address;
  61. }
  62. - (void)awakeFromNib {
  63. [super awakeFromNib];
  64. // Initialization code
  65. }
  66. - (void)setSelected:(BOOL)selected animated:(BOOL)animated {
  67. [super setSelected:selected animated:animated];
  68. // Configure the view for the selected state
  69. }
  70. @end