Index: ios/chrome/browser/ui/qr_scanner/qr_scanner_view.mm |
diff --git a/ios/chrome/browser/ui/qr_scanner/qr_scanner_view.mm b/ios/chrome/browser/ui/qr_scanner/qr_scanner_view.mm |
index 2101964d24e869103647dbd2bad3b2520181af46..913f0b678a90768a08cd5c58e294015f6cee28fc 100644 |
--- a/ios/chrome/browser/ui/qr_scanner/qr_scanner_view.mm |
+++ b/ios/chrome/browser/ui/qr_scanner/qr_scanner_view.mm |
@@ -41,7 +41,9 @@ const CGFloat kViewportBorderShadowOpacity = 1.0; |
// Shadow radius of the viewport border. |
const CGFloat kViewportBorderShadowRadius = 10.0; |
// Padding of the viewport caption, below the viewport. |
-const CGFloat kViewportCaptionPadding = 24.0; |
+const CGFloat kViewportCaptionVerticalPadding = 14.0; |
+// Padding of the viewport caption from the edges of the superview. |
+const CGFloat kViewportCaptionHorizontalPadding = 20.0; |
// Shadow opacity of the viewport caption. |
const CGFloat kViewportCaptionShadowOpacity = 1.0; |
// Shadow radius of the viewport caption. |
@@ -470,6 +472,8 @@ CGFloat GetViewportSize() { |
UILabel* viewportCaption = [[[UILabel alloc] init] autorelease]; |
NSString* label = l10n_util::GetNSString(IDS_IOS_QR_SCANNER_VIEWPORT_CAPTION); |
[viewportCaption setText:label]; |
+ [viewportCaption setNumberOfLines:0]; |
+ [viewportCaption setTextAlignment:NSTextAlignmentCenter]; |
[viewportCaption setAccessibilityLabel:label]; |
[viewportCaption setAccessibilityIdentifier:@"qr_scanner_viewport_caption"]; |
[viewportCaption setTextColor:[UIColor whiteColor]]; |
@@ -484,11 +488,16 @@ CGFloat GetViewportSize() { |
// Constraints for viewportCaption. |
[viewportCaption setTranslatesAutoresizingMaskIntoConstraints:NO]; |
[NSLayoutConstraint activateConstraints:@[ |
- [[viewportCaption centerXAnchor] |
- constraintEqualToAnchor:[self centerXAnchor]], |
- [[viewportCaption centerYAnchor] |
+ [[viewportCaption topAnchor] |
constraintEqualToAnchor:[self centerYAnchor] |
- constant:GetViewportSize() / 2 + kViewportCaptionPadding] |
+ constant:GetViewportSize() / 2 + |
+ kViewportCaptionVerticalPadding], |
+ [viewportCaption.leadingAnchor |
+ constraintEqualToAnchor:self.leadingAnchor |
+ constant:kViewportCaptionHorizontalPadding], |
+ [viewportCaption.trailingAnchor |
+ constraintEqualToAnchor:self.trailingAnchor |
+ constant:-kViewportCaptionHorizontalPadding], |
]]; |
} |