tweak title position in posts view controller

This commit is contained in:
Sami Samhuri 2015-05-09 17:33:17 -07:00
parent 773c4af62e
commit 142ff60dc7

View file

@ -88,7 +88,7 @@ static const NSUInteger SectionPublished = 1;
titleLabel.text = self.navigationItem.title; titleLabel.text = self.navigationItem.title;
[titleLabel sizeToFit]; [titleLabel sizeToFit];
[titleView addSubview:titleLabel]; [titleView addSubview:titleLabel];
NSLayoutConstraint *topConstraint = [NSLayoutConstraint constraintWithItem:titleLabel attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:titleView attribute:NSLayoutAttributeTop multiplier:1 constant:23]; NSLayoutConstraint *topConstraint = [NSLayoutConstraint constraintWithItem:titleLabel attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:titleView attribute:NSLayoutAttributeTop multiplier:1 constant:0];
[titleView addConstraint:topConstraint]; [titleView addConstraint:topConstraint];
self.titleLabelTopConstraint = topConstraint; self.titleLabelTopConstraint = topConstraint;
[titleView addConstraint:[NSLayoutConstraint constraintWithItem:titleLabel attribute:NSLayoutAttributeCenterX relatedBy:NSLayoutRelationEqual toItem:titleView attribute:NSLayoutAttributeCenterX multiplier:1 constant:0]]; [titleView addConstraint:[NSLayoutConstraint constraintWithItem:titleLabel attribute:NSLayoutAttributeCenterX relatedBy:NSLayoutRelationEqual toItem:titleView attribute:NSLayoutAttributeCenterX multiplier:1 constant:0]];
@ -99,7 +99,7 @@ static const NSUInteger SectionPublished = 1;
subtitleLabel.textColor = [UIColor whiteColor]; subtitleLabel.textColor = [UIColor whiteColor];
[subtitleLabel sizeToFit]; [subtitleLabel sizeToFit];
[titleView addSubview:subtitleLabel]; [titleView addSubview:subtitleLabel];
[titleView addConstraint:[NSLayoutConstraint constraintWithItem:subtitleLabel attribute:NSLayoutAttributeBottom relatedBy:NSLayoutRelationEqual toItem:titleView attribute:NSLayoutAttributeBottom multiplier:1 constant:-6]]; [titleView addConstraint:[NSLayoutConstraint constraintWithItem:subtitleLabel attribute:NSLayoutAttributeBottom relatedBy:NSLayoutRelationEqual toItem:titleView attribute:NSLayoutAttributeBottom multiplier:1 constant:-9]];
[titleView addConstraint:[NSLayoutConstraint constraintWithItem:subtitleLabel attribute:NSLayoutAttributeCenterX relatedBy:NSLayoutRelationEqual toItem:titleView attribute:NSLayoutAttributeCenterX multiplier:1 constant:0]]; [titleView addConstraint:[NSLayoutConstraint constraintWithItem:subtitleLabel attribute:NSLayoutAttributeCenterX relatedBy:NSLayoutRelationEqual toItem:titleView attribute:NSLayoutAttributeCenterX multiplier:1 constant:0]];
self.statusLabel = subtitleLabel; self.statusLabel = subtitleLabel;
self.navigationItem.titleView = titleView; self.navigationItem.titleView = titleView;
@ -114,10 +114,11 @@ static const NSUInteger SectionPublished = 1;
{ {
// status bar // status bar
height += 20; height += 20;
top += 20; top += 15;
} }
self.titleViewHeightConstraint.constant = height; self.titleViewHeightConstraint.constant = height;
self.titleLabelTopConstraint.constant = top; self.titleLabelTopConstraint.constant = top;
[self.titleLabel.superview setNeedsUpdateConstraints];
} }
- (void)updateOnClassInjection { - (void)updateOnClassInjection {