@@ -25,8 +25,14 @@ @interface XHLocationServiceTableViewCell ()
2525@implementation XHLocationServiceTableViewCell
2626
2727- (void )configureCellWithItem : (id )item atIndexPath : (NSIndexPath *)indexPath {
28- self.userNameLabel .text = item;
29- self.distanseLabel .text = @" 1000米以内" ;
28+ self.distanseLabel .text = @" 10米以内" ;
29+ if (indexPath.row % 2 ) {
30+ self.userNameLabel .text = @" 杨仁捷" ;
31+ self.introductionLabel .text = @" 杨仁捷是UI/UE设计师,也是我的好拍档,有着编程功底,绝对是一个好设计师,UI设计可以帮程序员节省一大堆代码,这才是真正的设计师" ;
32+ } else {
33+ self.userNameLabel .text = @" 吴盛潮" ;
34+ self.introductionLabel .text = @" 吴盛潮是iOS开发者,也是我的好伙伴,iOS大神,找大神,找大神,一直会以技术支持的角色,所以你们不比害怕问题解决不了!" ;
35+ }
3036}
3137
3238#pragma mark - Propertys
@@ -41,23 +47,55 @@ - (UIImageView *)avatorImageView {
4147
4248- (UILabel *)userNameLabel {
4349 if (!_userNameLabel) {
44- _userNameLabel = [[UILabel alloc ] initWithFrame: CGRectMake (CGRectGetMaxX (self .avatorImageView.frame) + kXHNearAvatorSpacing , kXHNearAvatorSpacing , 100 , 30 )];
50+ _userNameLabel = [[UILabel alloc ] initWithFrame: CGRectMake (CGRectGetMaxX (self .avatorImageView.frame) + kXHNearAvatorSpacing , kXHNearAvatorSpacing , 55 , 30 )];
4551 _userNameLabel.backgroundColor = [UIColor clearColor ];
4652 _userNameLabel.textColor = [UIColor blackColor ];
4753 _userNameLabel.font = [UIFont boldSystemFontOfSize: 17 ];
4854 }
4955 return _userNameLabel;
5056}
57+ - (UIImageView *)userSexImageView {
58+ if (!_userSexImageView) {
59+ _userSexImageView = [[UIImageView alloc ] initWithImage: [UIImage imageNamed: @" Contact_Male" ]];
60+ CGRect userSexImageViewFrame = _userSexImageView.frame ;
61+ userSexImageViewFrame.origin .x = CGRectGetMaxX (self.userNameLabel .frame );
62+ userSexImageViewFrame.origin .y = CGRectGetMidY (self.userNameLabel .frame ) - CGRectGetHeight (userSexImageViewFrame) / 2.0 ;
63+ _userSexImageView.frame = userSexImageViewFrame;
64+ }
65+ return _userSexImageView;
66+ }
5167
5268- (UILabel *)distanseLabel {
5369 if (!_distanseLabel) {
54- _distanseLabel = [[UILabel alloc ] initWithFrame: CGRectMake (CGRectGetMinX (self .userNameLabel.frame), CGRectGetMaxY (self .userNameLabel.frame), 100 , 20 )];
70+ _distanseLabel = [[UILabel alloc ] initWithFrame: CGRectMake (CGRectGetMinX (self .userNameLabel.frame), CGRectGetMaxY (self .userNameLabel.frame), 50 , 15 )];
5571 _distanseLabel.font = [UIFont systemFontOfSize: 12 ];
5672 _distanseLabel.backgroundColor = [UIColor clearColor ];
5773 _distanseLabel.textColor = [UIColor grayColor ];
5874 }
5975 return _distanseLabel;
6076}
77+ - (UIImageView *)albumImageView {
78+ if (!_albumImageView) {
79+ _albumImageView = [[UIImageView alloc ] initWithImage: [UIImage imageNamed: @" AlbumFlagMark" ]];
80+ CGRect albumImageViewFrame = _albumImageView.frame ;
81+ albumImageViewFrame.origin .x = CGRectGetMaxX (self.distanseLabel .frame );
82+ albumImageViewFrame.origin .y = CGRectGetMinY (self.distanseLabel .frame );
83+ _albumImageView.frame = albumImageViewFrame;
84+ }
85+ return _albumImageView;
86+ }
87+
88+ - (UILabel *)introductionLabel {
89+ if (!_introductionLabel) {
90+ _introductionLabel = [[UILabel alloc ] initWithFrame: CGRectMake (CGRectGetWidth ([[UIScreen mainScreen ] bounds ]) - kXHNearAvatorSpacing - 160 , kXHNearAvatorSpacing , 160 , kXHNearAvatorSize )];
91+ _introductionLabel.font = [UIFont systemFontOfSize: 10 ];
92+ _introductionLabel.backgroundColor = [UIColor clearColor ];
93+ _introductionLabel.textColor = [UIColor colorWithRed: 0.097 green: 0.633 blue: 1.000 alpha: 1.000 ];
94+ _introductionLabel.lineBreakMode = NSLineBreakByTruncatingTail;
95+ _introductionLabel.numberOfLines = 0 ;
96+ }
97+ return _introductionLabel;
98+ }
6199
62100#pragma mark - Life Cycle
63101
@@ -67,7 +105,10 @@ - (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reus
67105 // Initialization code
68106 [self .contentView addSubview: self .avatorImageView];
69107 [self .contentView addSubview: self .userNameLabel];
108+ [self .contentView addSubview: self .userSexImageView];
70109 [self .contentView addSubview: self .distanseLabel];
110+ [self .contentView addSubview: self .albumImageView];
111+ [self .contentView addSubview: self .introductionLabel];
71112 }
72113 return self;
73114}
0 commit comments