How to Highlight the Tab's Text?
Hi there, Currently I am using this framework to developing something.
When i am in current tab. I would like the Text Colour to change to white colour. any idea how to did this?
Currently there's not an implementation for this kind of feature, but with a quick thought, it came to my mind that you can track the tab views you're providing to ViewPagerController and edit them in your subclass.
@LeeMing988
A temporary solution is to add some lines in the - (void)setActiveTabIndex:(NSUInteger)activeTabIndex method.
like this:
// Set to-be-inactive tab unselected
activeTabView = [self tabViewAtIndex:self.activeTabIndex];
activeTabView.selected = NO;
labelSubview = activeTabView.subviews[0];
labelSubview.textColor = [UIColor blackColor];
// Set to-be-active tab selected
activeTabView = [self tabViewAtIndex:activeTabIndex];
activeTabView.selected = YES;
labelSubview = activeTabView.subviews[0];
labelSubview.textColor = [UIColor whiteColor];
Hope this could help you.
Any Update on Highlight the Tab's Text ?
Here is my solution, referencing @EdwardDing's solution:
In ViewPagerController.h, change the ViewPagerComponent ENUM to:
typedef NS_ENUM(NSUInteger, ViewPagerComponent) {
ViewPagerIndicator,
ViewPagerTabsView,
ViewPagerContent,
ViewPagerSelectedText,
ViewPagerUnselectedText
};
In ViewPagerController.m:
// Set to-be-inactive tab unselected
activeTabView = [self tabViewAtIndex:self.activeTabIndex];
activeTabView.selected = NO;
UILabel* labelSubview = activeTabView.subviews[0];
labelSubview.textColor = [self.delegate viewPager:self colorForComponent:ViewPagerUnselectedText withDefault:[UIColor blackColor]];
// Set to-be-active tab selected
activeTabView = [self tabViewAtIndex:activeTabIndex];
activeTabView.selected = YES;
labelSubview = activeTabView.subviews[0];
labelSubview.textColor = [self.delegate viewPager:self colorForComponent:ViewPagerSelectedText withDefault:[UIColor grayColor]];
Hope @iltercengiz can merge these to next version, along with the Y offset functionalities.