Commit a83543bf authored by Javier Ernesto Flores Robles's avatar Javier Ernesto Flores Robles Committed by Commit Bot

[iOS] Fix landscape popover presentation

Updating preferred ContentSize inside updateViewConstraints was causing
the popover arrow to not be pointing to the right place. Instead update
the preferred size when the trait collection changes and before the view
appears.

There is still a bit offset when the bar button is bigger than the
popover arrow and the button is on the screen margin. This is caused by
the popover being also layout at the margin without space to center the
arrow.

Bug: N/A
Change-Id: I10017b379c7688bea2cd6e514d0bf98a176c9c25
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2215332Reviewed-by: default avatarSebastien Lalancette <seblalancette@chromium.org>
Reviewed-by: default avatarOlivier Robin <olivierrobin@chromium.org>
Auto-Submit: Javier Ernesto Flores Robles <javierrobles@chromium.org>
Commit-Queue: Olivier Robin <olivierrobin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#772171}
parent 22959d16
......@@ -40,6 +40,8 @@ constexpr CGFloat kWidthProportion = 0.75;
return self;
}
#pragma mark - UIViewController
- (void)viewDidLoad {
[super viewDidLoad];
......@@ -79,6 +81,23 @@ constexpr CGFloat kWidthProportion = 0.75;
heightConstraint.active = YES;
}
- (void)viewWillAppear:(BOOL)animated {
[self updatePreferredContentSize];
[super viewWillAppear:animated];
}
- (void)traitCollectionDidChange:(UITraitCollection*)previousTraitCollection {
[super traitCollectionDidChange:previousTraitCollection];
if ((self.traitCollection.verticalSizeClass !=
previousTraitCollection.verticalSizeClass) ||
(self.traitCollection.horizontalSizeClass !=
previousTraitCollection.horizontalSizeClass)) {
[self updatePreferredContentSize];
}
}
#pragma mark - UIAdaptivePresentationControllerDelegate
- (UIModalPresentationStyle)
adaptivePresentationStyleForPresentationController:
(UIPresentationController*)controller
......@@ -87,11 +106,6 @@ constexpr CGFloat kWidthProportion = 0.75;
return UIModalPresentationNone;
}
- (void)updateViewConstraints {
[self updatePreferredContentSize];
[super updateViewConstraints];
}
#pragma mark - Helpers
// Updates the preferred content size according to the presenting view size and
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment