-
Notifications
You must be signed in to change notification settings - Fork 122
Fix content insets when automaticallyAdjustsScrollViewInsets is set to NO #420
Conversation
d12eab5
to
e45a10d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just some confusion with naming here on my part. Any chance of consolidating here?
@@ -941,10 +932,54 @@ - (void)updateConstraintsForOrnament:(UIView *)view | |||
[constraints addObjectsFromArray:updatedConstraints]; | |||
} | |||
|
|||
- (BOOL)hasAutomaticallyAdjustContentInset { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: I'm having trouble understanding the meaning of the method name.
Can we match the similar view controller method? automaticallyAdjustsContentInsets
depending on context?
EDIT: Oh, I see - (BOOL)automaticallyAdjustsContentInset
- I'm more confused now 😕
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hasAutomaticallyAdjustContentInset
is an internal convenience method to avoid code duplication. Since we have two ways to check if we disabled adjusting automatically content insets: using UIViewController.automaticallyAdjustsScrollViewInsets
(deprecated) and MGLMapView.automaticallyAdjustContentInset
I am using this method to check these options.
- (NSLayoutYAxisAnchor *)safeTopAnchor { | ||
if ([self hasAutomaticallyAdjustContentInset]) { | ||
return self.mgl_safeTopAnchor; | ||
} else { | ||
return self.topAnchor; | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Another confusing one for me - is there anyway to combine safeTapAnchor
and mgl_safeTopAnchor
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What this method is doing is check if it has automatically adjust content insets. If it has then it uses an anchor that considers safe areas which is self.mgl_safeTopAnchor
that is in a category, if it is not then uses the current view anchor without considering safe areas.
* master: Fix content insets when automaticallyAdjustsScrollViewInsets is set to NO (#420)
…o NO (#420) * Fix an issue when automaticallyAdjustContentInset is set to NO * Update tests to account for safe areas on iOS 11 * Update changelog * Update method documentation
* changing the default size for approx ring border when zoomed out (#429) * Approximate Location "Puck" logic updates (#427) * updates to approximate puck drawing logic * removing unused header * Allow for transitive dependencies (#431) * Fix content insets when automaticallyAdjustsScrollViewInsets is set to NO (#420) * Fix an issue when automaticallyAdjustContentInset is set to NO * Update tests to account for safe areas on iOS 11 * Update changelog * Update method documentation * Update to gl-native 5.0.0 (#438) * Update to application state management and associated view setup and rendering (#432) Co-authored-by: Neel Mistry <Neel.mistry@mapbox.com> Co-authored-by: Fredrik Karlsson <bjorn.fredrik.karlsson@gmail.com> Co-authored-by: Julian Rex <julian.rex@mapbox.com>
Fixes #167