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. // NOTE: the margin values are inverted in RTL layouts.
- (BOOL)isRTL; - (BOOL)isRTL;
- (NSLayoutConstraint *)autoPinLeadingAndTrailingToSuperview; - (NSArray<NSLayoutConstraint *> *)autoPinLeadingAndTrailingToSuperview;
- (NSLayoutConstraint *)autoPinLeadingToSuperView; - (NSLayoutConstraint *)autoPinLeadingToSuperView;
- (NSLayoutConstraint *)autoPinLeadingToSuperViewWithMargin:(CGFloat)margin; - (NSLayoutConstraint *)autoPinLeadingToSuperViewWithMargin:(CGFloat)margin;
- (NSLayoutConstraint *)autoPinTrailingToSuperView; - (NSLayoutConstraint *)autoPinTrailingToSuperView;

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

@ -181,7 +181,7 @@ NS_ASSUME_NONNULL_BEGIN
[_submitCodeSpinner autoSetDimension:ALDimensionWidth toSize:kSpinnerSize]; [_submitCodeSpinner autoSetDimension:ALDimensionWidth toSize:kSpinnerSize];
[_submitCodeSpinner autoSetDimension:ALDimensionHeight toSize:kSpinnerSize]; [_submitCodeSpinner autoSetDimension:ALDimensionHeight toSize:kSpinnerSize];
[_submitCodeSpinner autoVCenterInSuperview]; [_submitCodeSpinner autoVCenterInSuperview];
[_submitCodeSpinner autoPinEdgeToSuperviewEdge:ALEdgeRight withInset:kSpinnerSpacing]; [_submitCodeSpinner autoPinTrailingToSuperViewWithMargin:kSpinnerSpacing];
_sendCodeViaSMSAgainButton = [UIButton buttonWithType:UIButtonTypeCustom]; _sendCodeViaSMSAgainButton = [UIButton buttonWithType:UIButtonTypeCustom];
_sendCodeViaSMSAgainButton.backgroundColor = [UIColor whiteColor]; _sendCodeViaSMSAgainButton.backgroundColor = [UIColor whiteColor];
@ -204,7 +204,7 @@ NS_ASSUME_NONNULL_BEGIN
[_requestCodeAgainSpinner autoSetDimension:ALDimensionWidth toSize:kSpinnerSize]; [_requestCodeAgainSpinner autoSetDimension:ALDimensionWidth toSize:kSpinnerSize];
[_requestCodeAgainSpinner autoSetDimension:ALDimensionHeight toSize:kSpinnerSize]; [_requestCodeAgainSpinner autoSetDimension:ALDimensionHeight toSize:kSpinnerSize];
[_requestCodeAgainSpinner autoVCenterInSuperview]; [_requestCodeAgainSpinner autoVCenterInSuperview];
[_requestCodeAgainSpinner autoPinEdgeToSuperviewEdge:ALEdgeRight withInset:kSpinnerSpacing]; [_requestCodeAgainSpinner autoPinTrailingToSuperViewWithMargin:kSpinnerSpacing];
_sendCodeViaVoiceButton = [UIButton buttonWithType:UIButtonTypeCustom]; _sendCodeViaVoiceButton = [UIButton buttonWithType:UIButtonTypeCustom];
_sendCodeViaVoiceButton.backgroundColor = [UIColor whiteColor]; _sendCodeViaVoiceButton.backgroundColor = [UIColor whiteColor];
@ -227,7 +227,7 @@ NS_ASSUME_NONNULL_BEGIN
[_requestCallSpinner autoSetDimension:ALDimensionWidth toSize:kSpinnerSize]; [_requestCallSpinner autoSetDimension:ALDimensionWidth toSize:kSpinnerSize];
[_requestCallSpinner autoSetDimension:ALDimensionHeight toSize:kSpinnerSize]; [_requestCallSpinner autoSetDimension:ALDimensionHeight toSize:kSpinnerSize];
[_requestCallSpinner autoVCenterInSuperview]; [_requestCallSpinner autoVCenterInSuperview];
[_requestCallSpinner autoPinEdgeToSuperviewEdge:ALEdgeRight withInset:kSpinnerSpacing]; [_requestCallSpinner autoPinTrailingToSuperViewWithMargin:kSpinnerSpacing];
} }
- (NSString *)phoneNumberText - (NSString *)phoneNumberText

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

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

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

Loading…
Cancel
Save