Skip to content

Commit 7df73cd

Browse files
committed
Moved layout from init to layoutSubviews, fixes #4
1 parent ae11353 commit 7df73cd

1 file changed

Lines changed: 10 additions & 3 deletions

File tree

BitStore/Cells/TransactionCell.m

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,16 +33,16 @@ @implementation TransactionCell {
3333
- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
3434
self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
3535

36-
_personLabel = [[UILabel alloc] initWithFrame:CGRectMake(10, 0, 170, 55)];
36+
_personLabel = [[UILabel alloc] init];
3737
_personLabel.font = [UIFont fontWithName:@"HelveticaNeue-Light" size:18];
3838
[self addSubview:_personLabel];
3939

40-
_valueLabel = [[UILabel alloc] initWithFrame:CGRectMake(self.frame.size.width - 210, 8, 200, 20)];
40+
_valueLabel = [[UILabel alloc] init];
4141
_valueLabel.font = [UIFont fontWithName:@"HelveticaNeue-Light" size:18];
4242
_valueLabel.textAlignment = NSTextAlignmentRight;
4343
[self addSubview:_valueLabel];
4444

45-
_dateLabel = [[UILabel alloc] initWithFrame:CGRectMake(self.frame.size.width - 210, 28, 200, 20)];
45+
_dateLabel = [[UILabel alloc] init];
4646
_dateLabel.font = [UIFont systemFontOfSize:11];
4747
_dateLabel.textAlignment = NSTextAlignmentRight;
4848
_dateLabel.textColor = [UIColor colorWithWhite:0.65 alpha:1.0];
@@ -101,6 +101,13 @@ - (void)updateValues {
101101
}
102102
}
103103

104+
- (void)layoutSubviews {
105+
[super layoutSubviews];
106+
_personLabel.frame = CGRectMake(10, 0, self.frame.size.width - 145, 55);
107+
_valueLabel.frame = CGRectMake(self.frame.size.width - 135, 8, 125, 20);
108+
_dateLabel.frame = CGRectMake(self.frame.size.width - 135, 28, 125, 20);
109+
}
110+
104111
- (void)setHighlighted:(BOOL)highlighted animated:(BOOL)animated {
105112
// hack to avoid the background reset the UITableView does on all subviews
106113
[super setHighlighted:highlighted animated:animated];

0 commit comments

Comments
 (0)