-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDetailQuestionCell.m
52 lines (40 loc) · 1.47 KB
/
DetailQuestionCell.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
//
// DetailQuestionCell.m
// unnamed
//
// Created by Bruce Ng on 2/19/15.
// Copyright (c) 2015 com.yahoo. All rights reserved.
//
#import "DetailQuestionCell.h"
#import "ProfileImageView.h"
#import "NSDate+MinimalTimeAgo.h"
@interface DetailQuestionCell()
@property (nonatomic, strong) Question *question;
@property (nonatomic, strong) User *user;
@property (nonatomic, assign) NSInteger totalVoteCount;
@property (weak, nonatomic) IBOutlet UILabel *nameLabel;
@property (weak, nonatomic) IBOutlet UILabel *questionLabel;
@property (weak, nonatomic) IBOutlet UILabel *timeLabel;
@property (weak, nonatomic) IBOutlet UILabel *voteCountLabel;
@end
@implementation DetailQuestionCell
- (void)awakeFromNib {
// In here to fix TableCell layout issue when using UITableViewAutomaticDimension
// But was this fix in the latest version?
self.questionLabel.preferredMaxLayoutWidth = self.questionLabel.frame.size.width;
}
- (void) layoutSubviews {
self.profileImageView.user = self.user;
self.nameLabel.text = self.user.name;
self.questionLabel.text = self.question.text;
self.timeLabel.text = [self.question.createdAt timeAgo];
self.voteCountLabel.text = [NSString stringWithFormat:@"%ld", (long)self.totalVoteCount];
}
- (void) initWithQuestion:(Question *)question user:(User *)user totalCount:(NSInteger)count {
_question = question;
_user = user;
_totalVoteCount = count;
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
}
@end