@@ -114,6 +114,14 @@ - (NSUInteger)minimumTabWidth
114114
115115- (void )setShowsAddTabButton : (BOOL )showsAddTabButton
116116{
117+ // showsAddTabButton:
118+ // The trailing constraint is a 5pt margin.
119+ // !showsAddTabButton:
120+ // The trailing constraint is a negative margin so the add
121+ // button is clipped out of the right side of the view. The
122+ // amount of negative margin is the width of the button plus
123+ // the 5 to account for the margin between the scroll view
124+ // and the button.
117125 if (_showsAddTabButton != showsAddTabButton) {
118126 _showsAddTabButton = showsAddTabButton;
119127 _addTabButtonTrailingConstraint.constant = showsAddTabButton ? 5 : -(NSWidth (_addTabButton.frame ) + 5 );;
@@ -122,9 +130,18 @@ - (void)setShowsAddTabButton:(BOOL)showsAddTabButton
122130
123131- (void )setShowsTabScrollButtons : (BOOL )showsTabScrollButtons
124132{
133+ // showsTabScrollButtons:
134+ // The leading constraint is a 5pt margin.
135+ // !showsTabScrollButtons:
136+ // The leading constraint is a negative margin so the scroll
137+ // buttons are clipped out of the left side of the view. The
138+ // amount of the negative margin is the width of each button
139+ // plus 5 to account for the margin between the buttons and
140+ // the scroll view plus 2 to account for the 2pt shadow inset
141+ // of each tab (see -drawRect: in MMTab.m).
125142 if (_showsTabScrollButtons != showsTabScrollButtons) {
126143 _showsTabScrollButtons = showsTabScrollButtons;
127- _tabScrollButtonsLeadingConstraint.constant = showsTabScrollButtons ? 5 : -((NSWidth (_leftScrollButton.frame ) * 2 ) + 5 );
144+ _tabScrollButtonsLeadingConstraint.constant = showsTabScrollButtons ? 5 : -((NSWidth (_leftScrollButton.frame ) * 2 ) + 5 + 2 );
128145 }
129146}
130147
0 commit comments