@@ -87,14 +87,14 @@ @interface MDCBottomNavigationBarController ()
8787@property (nonatomic , strong , nullable ) NSLayoutConstraint *navigationBarBottomAnchorConstraint;
8888
8989/* * The constraint between @c navigationBar.barItemsBottomAnchor and the bottom of the safe area. */
90- @property (nonatomic , strong , nullable ) NSLayoutConstraint *navigationBarItemsBottomAnchorConstraint;
90+ @property (nonatomic , strong , nonnull ) NSLayoutConstraint *navigationBarItemsBottomAnchorConstraint;
9191
9292/* * The constraints for the @c navigationBar in a vertical layout. */
9393@property (nonatomic , strong , nonnull )
9494 NSMutableArray <NSLayoutConstraint *> *navigationBarVerticalLayoutConstraints;
9595
9696/* * The constraint between the leading edge of @c navigationBar and its superview. */
97- @property (nonatomic , strong , nullable ) NSLayoutConstraint *navigationBarLeadingAnchorConstraint;
97+ @property (nonatomic , strong , nonnull ) NSLayoutConstraint *navigationBarLeadingAnchorConstraint;
9898
9999/* * The constraints for the @c navigationBar in a horizontal layout. */
100100@property (nonatomic , strong , nonnull )
@@ -217,7 +217,6 @@ - (void)hideNavigationBarHelper:(BOOL)hidden {
217217 if (!navigationBar.enableVerticalLayout ) {
218218 CGFloat height = CGRectGetHeight (navigationBar.frame );
219219 self.navigationBarBottomAnchorConstraint .constant = hidden ? height : 0 ;
220- self.navigationBarLeadingAnchorConstraint .constant = 0 ;
221220 } else {
222221 CGFloat width = CGRectGetWidth (navigationBar.frame );
223222 self.navigationBarBottomAnchorConstraint .constant = 0 ;
@@ -720,21 +719,24 @@ - (void)loadConstraintsBasedOnRule {
720719
721720- (void )loadConstraintsForNavigationBar {
722721 self.navigationBar .translatesAutoresizingMaskIntoConstraints = NO ;
723- self.navigationBarLeadingAnchorConstraint = [self .navigationBar.leadingAnchor
724- constraintEqualToAnchor: self .view.safeAreaLayoutGuide.leadingAnchor];
725- self.navigationBarLeadingAnchorConstraint .active = YES ;
726722 self.navigationBarBottomAnchorConstraint =
727723 [self .navigationBar.bottomAnchor constraintEqualToAnchor: self .view.bottomAnchor];
728724 self.navigationBarBottomAnchorConstraint .active = YES ;
725+
726+ self.navigationBarLeadingAnchorConstraint = [self .navigationBar.leadingAnchor
727+ constraintEqualToAnchor: self .view.safeAreaLayoutGuide.leadingAnchor];
729728 self.navigationBarItemsBottomAnchorConstraint = [self .navigationBar.barItemsBottomAnchor
730729 constraintEqualToAnchor: self .view.safeAreaLayoutGuide.bottomAnchor];
731730
732731 [self .navigationBarVerticalLayoutConstraints
733732 addObject: [self .navigationBar.topAnchor constraintEqualToAnchor: self .view.topAnchor]];
733+ [self .navigationBarVerticalLayoutConstraints addObject: self .navigationBarLeadingAnchorConstraint];
734734
735735 [self .navigationBarHorizontalLayoutConstraints
736- addObject: [self .view.safeAreaLayoutGuide. trailingAnchor
736+ addObject: [self .view.trailingAnchor
737737 constraintEqualToAnchor: self .navigationBar.trailingAnchor]];
738+ [self .navigationBarHorizontalLayoutConstraints
739+ addObject: [self .navigationBar.leadingAnchor constraintEqualToAnchor: self .view.leadingAnchor]];
738740 [self .navigationBarHorizontalLayoutConstraints
739741 addObject: self .navigationBarItemsBottomAnchorConstraint];
740742}
0 commit comments