diff options
author | Vitaly Takmazov | 2014-02-01 20:17:59 +0400 |
---|---|---|
committer | Vitaly Takmazov | 2014-02-01 20:17:59 +0400 |
commit | 552680443dea2ea5e3ce64d03dc4b6d2e39a7226 (patch) | |
tree | 73551b057735dd16406343831b5412c2ffb9c177 /Juick/NavCell.m | |
parent | 50a0ecf985bbe81aacfac85192652c2495b769f6 (diff) |
Manual layout in reveal panel, deployment target now ios 5.1
Diffstat (limited to 'Juick/NavCell.m')
-rw-r--r-- | Juick/NavCell.m | 27 |
1 files changed, 9 insertions, 18 deletions
diff --git a/Juick/NavCell.m b/Juick/NavCell.m index 0b16e43..594b23b 100644 --- a/Juick/NavCell.m +++ b/Juick/NavCell.m @@ -23,31 +23,22 @@ self.backgroundColor = [UIColor blackColor]; self.iconLabel = [[UILabel alloc] initWithFrame:CGRectZero]; self.descriptionTextLabel = [[UILabel alloc] initWithFrame:CGRectZero]; + self.descriptionTextLabel.numberOfLines = 1; + self.descriptionTextLabel.textAlignment = NSTextAlignmentLeft; [self.contentView addSubview:self.iconLabel]; [self.contentView addSubview:self.descriptionTextLabel]; } return self; } -- (void)updateConstraints { - [super updateConstraints]; +- (void)layoutSubviews { + [super layoutSubviews]; - if (self.didSetupConstraints) return; - [self.iconLabel makeConstraints:^(MASConstraintMaker *make) { - make.left.equalTo(self.contentView.left).with.offset(20.f); - make.top.equalTo(self.contentView.top).with.offset(10.f); - make.width.equalTo(@36); - make.height.equalTo(@36); - - }]; - - [self.descriptionTextLabel makeConstraints:^(MASConstraintMaker *make) { - make.left.equalTo(self.iconLabel.right).with.offset(10.f); - make.top.equalTo(self.contentView.top).with.offset(15.f); - make.right.equalTo(self.contentView.right).with.offset(-20.f); - }]; - - self.didSetupConstraints = YES; + CGRect iconRect = [UILabel sizeForLabel:self.iconLabel width:320.0f]; + self.iconLabel.frame = CGRectMake(10, 10, iconRect.size.width, iconRect.size.height); + float textHeight = [UILabel sizeForLabel:self.descriptionTextLabel width:320.0f].size.height; + self.descriptionTextLabel.frame = CGRectMake(10 + self.iconLabel.frame.size.width + 10, 10 + (iconRect.size.height - textHeight) / 2, + self.contentView.bounds.size.width - self.iconLabel.frame.size.width - 10*3, textHeight); } @end |