Adapt more UI elements to RTL.

// FREEBIE
pull/1/head
Matthew Chen 8 years ago
parent c799e18c74
commit 96fd5e11e5

@ -67,7 +67,7 @@ CGFloat ScaleFromIPhone5(CGFloat iPhone5Value);
//
// NOTE: the margin values are inverted in RTL layouts.
- (BOOL)isRTL;
- (NSLayoutConstraint *)autoPinLeadingAndTrailingToSuperview;
- (NSArray<NSLayoutConstraint *> *)autoPinLeadingAndTrailingToSuperview;
- (NSLayoutConstraint *)autoPinLeadingToSuperView;
- (NSLayoutConstraint *)autoPinLeadingToSuperViewWithMargin:(CGFloat)margin;
- (NSLayoutConstraint *)autoPinTrailingToSuperView;

@ -35,7 +35,6 @@ CGFloat ScaleFromIPhone5(CGFloat iPhone5Value)
{
[self autoPinEdge:ALEdgeLeft toEdge:ALEdgeLeft ofView:self.superview withOffset:+margin];
[self autoPinEdge:ALEdgeRight toEdge:ALEdgeRight ofView:self.superview withOffset:-margin];
// TODO:
}
- (void)autoPinWidthToSuperview
@ -44,10 +43,13 @@ CGFloat ScaleFromIPhone5(CGFloat iPhone5Value)
[self autoPinEdge:ALEdgeRight toEdge:ALEdgeRight ofView:self.superview];
}
- (void)autoPinLeadingAndTrailingToSuperview
- (NSArray<NSLayoutConstraint *> *)autoPinLeadingAndTrailingToSuperview
{
[self autoPinLeadingToSuperView];
[self autoPinTrailingToSuperView];
NSArray<NSLayoutConstraint *> *result = @[
[self autoPinLeadingToSuperView],
[self autoPinTrailingToSuperView],
];
return result;
}
- (void)autoPinHeightToSuperviewWithMargin:(CGFloat)margin

@ -181,8 +181,8 @@ NS_ASSUME_NONNULL_BEGIN
[_submitCodeSpinner autoSetDimension:ALDimensionWidth toSize:kSpinnerSize];
[_submitCodeSpinner autoSetDimension:ALDimensionHeight toSize:kSpinnerSize];
[_submitCodeSpinner autoVCenterInSuperview];
[_submitCodeSpinner autoPinEdgeToSuperviewEdge:ALEdgeRight withInset:kSpinnerSpacing];
[_submitCodeSpinner autoPinTrailingToSuperViewWithMargin:kSpinnerSpacing];
_sendCodeViaSMSAgainButton = [UIButton buttonWithType:UIButtonTypeCustom];
_sendCodeViaSMSAgainButton.backgroundColor = [UIColor whiteColor];
[_sendCodeViaSMSAgainButton setTitle:NSLocalizedString(@"VERIFICATION_CHALLENGE_SUBMIT_AGAIN", @"button text during registration to request another SMS code be sent")
@ -204,8 +204,8 @@ NS_ASSUME_NONNULL_BEGIN
[_requestCodeAgainSpinner autoSetDimension:ALDimensionWidth toSize:kSpinnerSize];
[_requestCodeAgainSpinner autoSetDimension:ALDimensionHeight toSize:kSpinnerSize];
[_requestCodeAgainSpinner autoVCenterInSuperview];
[_requestCodeAgainSpinner autoPinEdgeToSuperviewEdge:ALEdgeRight withInset:kSpinnerSpacing];
[_requestCodeAgainSpinner autoPinTrailingToSuperViewWithMargin:kSpinnerSpacing];
_sendCodeViaVoiceButton = [UIButton buttonWithType:UIButtonTypeCustom];
_sendCodeViaVoiceButton.backgroundColor = [UIColor whiteColor];
[_sendCodeViaVoiceButton setTitle:NSLocalizedString(@"VERIFICATION_CHALLENGE_SEND_VIA_VOICE",
@ -227,7 +227,7 @@ NS_ASSUME_NONNULL_BEGIN
[_requestCallSpinner autoSetDimension:ALDimensionWidth toSize:kSpinnerSize];
[_requestCallSpinner autoSetDimension:ALDimensionHeight toSize:kSpinnerSize];
[_requestCallSpinner autoVCenterInSuperview];
[_requestCallSpinner autoPinEdgeToSuperviewEdge:ALEdgeRight withInset:kSpinnerSpacing];
[_requestCallSpinner autoPinTrailingToSuperViewWithMargin:kSpinnerSpacing];
}
- (NSString *)phoneNumberText

@ -215,7 +215,7 @@ NSString *const kKeychainKey_LastRegisteredPhoneNumber = @"kKeychainKey_LastRegi
[spinnerView autoVCenterInSuperview];
[spinnerView autoSetDimension:ALDimensionWidth toSize:20.f];
[spinnerView autoSetDimension:ALDimensionHeight toSize:20.f];
[spinnerView autoPinEdgeToSuperviewEdge:ALEdgeRight withInset:20];
[spinnerView autoPinTrailingToSuperViewWithMargin:20.f];
[spinnerView stopAnimating];
// Existing Account Button

@ -110,15 +110,15 @@ NS_ASSUME_NONNULL_BEGIN
[fileView addSubview:imageView];
[imageView autoSetDimension:ALDimensionWidth toSize:imageSize];
[imageView autoSetDimension:ALDimensionHeight toSize:imageSize];
[imageView autoPinEdgeToSuperviewEdge:ALEdgeLeft];
[imageView autoPinLeadingToSuperView];
[imageView autoPinEdgeToSuperviewEdge:ALEdgeTop];
[imageView autoPinEdgeToSuperviewEdge:ALEdgeBottom];
UIView *fileNameLabel = [self createFileNameLabel];
[fileView addSubview:fileNameLabel];
[fileNameLabel autoAlignAxis:ALAxisHorizontal toSameAxisOfView:imageView];
[fileNameLabel autoPinEdge:ALEdgeLeft toEdge:ALEdgeRight ofView:imageView withOffset:imageLabelSpacing];
[fileNameLabel autoPinEdgeToSuperviewEdge:ALEdgeRight];
[fileNameLabel autoPinLeadingToTrailingOfView:imageView margin:imageLabelSpacing];
[fileNameLabel autoPinTrailingToSuperView];
[header addSubview:searchBar];
[searchBar autoPinWidthToSuperview];

@ -203,6 +203,8 @@
[section addItem:[OWSTableItem itemWithCustomCellBlock:^{
UITableViewCell *cell = [UITableViewCell new];
cell.preservesSuperviewLayoutMargins = YES;
cell.contentView.preservesSuperviewLayoutMargins = YES;
UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
button.backgroundColor = [UIColor ows_destructiveRedColor];
[button setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
@ -212,10 +214,8 @@
[cell.contentView addSubview:button];
[button autoSetDimension:ALDimensionHeight toSize:50.f];
[button autoVCenterInSuperview];
[button autoPinEdgeToSuperviewEdge:ALEdgeLeft
withInset:cell.layoutMargins.left + cell.contentView.layoutMargins.left];
[button autoPinEdgeToSuperviewEdge:ALEdgeRight
withInset:cell.layoutMargins.right + cell.contentView.layoutMargins.right];
[button autoPinLeadingToSuperView];
[button autoPinTrailingToSuperView];
[button addTarget:self action:@selector(unregisterUser) forControlEvents:UIControlEventTouchUpInside];
cell.selectionStyle = UITableViewCellSelectionStyleNone;
return cell;

Loading…
Cancel
Save