Fix layout of registration page for iPhoneX

// FREEBIE
pull/1/head
Michael Kirk 8 years ago
parent 1fa0dda582
commit b0ce60a38d

@ -61,41 +61,46 @@ NSString *const kKeychainKey_LastRegisteredPhoneNumber = @"kKeychainKey_LastRegi
- (void)createViews - (void)createViews
{ {
self.view.backgroundColor = [UIColor ows_signalBrandBlueColor]; self.view.backgroundColor = [UIColor whiteColor];
self.view.userInteractionEnabled = YES; self.view.userInteractionEnabled = YES;
[self.view [self.view
addGestureRecognizer:[[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(backgroundTapped:)]]; addGestureRecognizer:[[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(backgroundTapped:)]];
UIView *header = [UIView new]; UIView *headerWrapper = [UIView containerView];
header.backgroundColor = [UIColor ows_signalBrandBlueColor]; [self.view addSubview:headerWrapper];
[self.view addSubview:header]; headerWrapper.backgroundColor = UIColor.ows_signalBrandBlueColor;
[header autoPinToTopLayoutGuideOfViewController:self withInset:0];
[header autoPinWidthToSuperview]; UIView *headerContent = [UIView new];
[headerWrapper addSubview:headerContent];
[headerWrapper autoPinEdgesToSuperviewEdgesWithInsets:UIEdgeInsetsZero excludingEdge:ALEdgeBottom];
[headerContent autoPinEdgeToSuperviewEdge:ALEdgeBottom];
[headerContent autoPinToTopLayoutGuideOfViewController:self withInset:0];
[headerContent autoPinWidthToSuperview];
UILabel *headerLabel = [UILabel new]; UILabel *headerLabel = [UILabel new];
headerLabel.text = NSLocalizedString(@"REGISTRATION_TITLE_LABEL", @""); headerLabel.text = NSLocalizedString(@"REGISTRATION_TITLE_LABEL", @"");
headerLabel.textColor = [UIColor whiteColor]; headerLabel.textColor = [UIColor whiteColor];
headerLabel.font = [UIFont ows_mediumFontWithSize:ScaleFromIPhone5To7Plus(20.f, 24.f)]; headerLabel.font = [UIFont ows_mediumFontWithSize:ScaleFromIPhone5To7Plus(20.f, 24.f)];
[header addSubview:headerLabel]; [headerContent addSubview:headerLabel];
[headerLabel autoHCenterInSuperview]; [headerLabel autoHCenterInSuperview];
[headerLabel autoPinEdgeToSuperviewEdge:ALEdgeBottom withInset:14.f]; [headerLabel autoPinEdgeToSuperviewEdge:ALEdgeBottom withInset:14.f];
CGFloat screenHeight = MAX([UIScreen mainScreen].bounds.size.width, [UIScreen mainScreen].bounds.size.height); CGFloat screenHeight = MAX([UIScreen mainScreen].bounds.size.width, [UIScreen mainScreen].bounds.size.height);
if (screenHeight < 568) { if (screenHeight < 568) {
// iPhone 4s or smaller. // iPhone 4s or smaller.
[header autoSetDimension:ALDimensionHeight toSize:20]; [headerContent autoSetDimension:ALDimensionHeight toSize:20];
headerLabel.hidden = YES; headerLabel.hidden = YES;
} else if (screenHeight < 667) { } else if (screenHeight < 667) {
// iPhone 5 or smaller. // iPhone 5 or smaller.
[header autoSetDimension:ALDimensionHeight toSize:80]; [headerContent autoSetDimension:ALDimensionHeight toSize:80];
} else { } else {
[header autoSetDimension:ALDimensionHeight toSize:220]; [headerContent autoSetDimension:ALDimensionHeight toSize:220];
UIImage *logo = [UIImage imageNamed:@"logoSignal"]; UIImage *logo = [UIImage imageNamed:@"logoSignal"];
OWSAssert(logo); OWSAssert(logo);
UIImageView *logoView = [UIImageView new]; UIImageView *logoView = [UIImageView new];
logoView.image = logo; logoView.image = logo;
[header addSubview:logoView]; [headerContent addSubview:logoView];
[logoView autoHCenterInSuperview]; [logoView autoHCenterInSuperview];
[logoView autoPinEdge:ALEdgeBottom toEdge:ALEdgeTop ofView:headerLabel withOffset:-14.f]; [logoView autoPinEdge:ALEdgeBottom toEdge:ALEdgeTop ofView:headerLabel withOffset:-14.f];
} }
@ -112,7 +117,7 @@ NSString *const kKeychainKey_LastRegisteredPhoneNumber = @"kKeychainKey_LastRegi
[self.view addSubview:contentView]; [self.view addSubview:contentView];
[contentView autoPinToBottomLayoutGuideOfViewController:self withInset:0]; [contentView autoPinToBottomLayoutGuideOfViewController:self withInset:0];
[contentView autoPinWidthToSuperview]; [contentView autoPinWidthToSuperview];
[contentView autoPinEdge:ALEdgeTop toEdge:ALEdgeBottom ofView:header]; [contentView autoPinEdge:ALEdgeTop toEdge:ALEdgeBottom ofView:headerContent];
// Country // Country
UIView *countryRow = [UIView containerView]; UIView *countryRow = [UIView containerView];

Loading…
Cancel
Save