Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(258)

Unified Diff: ios/clean/chrome/browser/ui/toolbar/toolbar_view_controller.mm

Issue 2869903002: [ios clean] Dismisses ToolsMenu on Layout changes. (Closed)
Patch Set: Checks for frame changes Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ios/clean/chrome/browser/ui/tab_grid/tab_grid_view_controller.mm ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ios/clean/chrome/browser/ui/toolbar/toolbar_view_controller.mm
diff --git a/ios/clean/chrome/browser/ui/toolbar/toolbar_view_controller.mm b/ios/clean/chrome/browser/ui/toolbar/toolbar_view_controller.mm
index 48003841e5e842087ebc234347379bafe143ab22..3d08f60e3d20512a27cd0a3b5a01be3067aa546e 100644
--- a/ios/clean/chrome/browser/ui/toolbar/toolbar_view_controller.mm
+++ b/ios/clean/chrome/browser/ui/toolbar/toolbar_view_controller.mm
@@ -34,6 +34,7 @@ CGFloat kHorizontalMargin = 8.0f;
@property(nonatomic, strong) ToolbarButton* shareButton;
@property(nonatomic, strong) ToolbarButton* reloadButton;
@property(nonatomic, strong) ToolbarButton* stopButton;
+@property(nonatomic, assign) CGRect currentFrame;
@end
@implementation ToolbarViewController
@@ -49,6 +50,7 @@ CGFloat kHorizontalMargin = 8.0f;
@synthesize shareButton = _shareButton;
@synthesize reloadButton = _reloadButton;
@synthesize stopButton = _stopButton;
+@synthesize currentFrame = _currentFrame;
- (instancetype)init {
self = [super init];
@@ -59,6 +61,8 @@ CGFloat kHorizontalMargin = 8.0f;
return self;
}
+#pragma mark - View lifecyle
+
- (void)viewDidLoad {
self.view.backgroundColor = [UIColor lightGrayColor];
@@ -92,6 +96,17 @@ CGFloat kHorizontalMargin = 8.0f;
constraintEqualToAnchor:self.view.trailingAnchor
constant:-kHorizontalMargin],
]];
+
+ self.currentFrame = self.view.frame;
+}
+
+- (void)viewWillLayoutSubviews {
+ // We need to dismiss the ToolsMenu everytime the Toolbar frame changes
+ // (e.g. Size changes, rotation changes, etc.)
+ if (!CGRectEqualToRect(self.currentFrame, self.view.frame)) {
marq (ping after 24h) 2017/05/10 10:57:02 UIViewController (via the UIContentContainer proto
sczs 2017/05/10 15:32:32 I agree, its much better. Done.
+ [self.dispatcher closeToolsMenu];
+ }
+ self.currentFrame = self.view.frame;
}
#pragma mark - Components Setup
« no previous file with comments | « ios/clean/chrome/browser/ui/tab_grid/tab_grid_view_controller.mm ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698