Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Class/DYSlideView.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
@property (strong, nonatomic) UIColor *buttonNormalColor;
@property (strong, nonatomic) UIColor *buttonSelectedColor;
@property (strong, nonatomic) UIFont *buttonTitleFont;
@property (strong, nonatomic) UIFont *buttonSelectedTitleFont;

@property (nonatomic) BOOL scrollViewBounces;
@property (nonatomic) BOOL scrollEnabled;
Expand Down
4 changes: 4 additions & 0 deletions Class/DYSlideView.m
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,8 @@ - (void)updateSelectedButton:(UIButton *)button{
}
if (!(_selectedButton && [_slideBarButtons indexOfObject:_selectedButton] == [button tag])) {
_selectedButton = button;
[_selectedButton.titleLabel setTextAlignment:NSTextAlignmentCenter];
[_selectedButton.titleLabel setFont:_buttonSelectedTitleFont];
if (_delegate && [_delegate respondsToSelector:@selector(DY_didSelectButtonAtIndex:)]) {
[self.delegate DY_didSelectButtonAtIndex:[_selectedButton tag]];
}
Expand All @@ -194,7 +196,9 @@ - (void)scrollViewDidScroll:(UIScrollView *)scrollView {
for (UIButton *button in _slideBarButtons) {
if ([_slideBarButtons indexOfObject:button] == _currentBtnIndex) {
[[_slideBarButtons objectAtIndex:_currentBtnIndex] setTitleColor:_buttonSelectedColor forState:UIControlStateNormal];
[button.titleLabel setFont:_buttonSelectedTitleFont];
} else {
[button.titleLabel setFont:_buttonTitleFont];
[button setTitleColor:_buttonNormalColor forState:UIControlStateNormal];
}
}
Expand Down