In HMSegmentControl, I have added tableview in one of the segment View. When I am on the current section and I scroll up or down, I noticed that the tab highlighter always changes to 0. Why is it happening?
This is my scrollView code:
-(void)scrollViewDidScroll:(UIScrollView *)scrollView
{
CGFloat pageWidth = scrollView.frame.size.width;
int page = scrollView.contentOffset.x / pageWidth;
[self.chatSegment setSelectedSegmentIndex:page animated:YES];
NSLog(@"scrollViewDidScroll - You are now on page %i",page);
}
Log Value:
<UITableView: 0x128007e00; frame = (0 0; 320 568); clipsToBounds = YES; tag = 502; gestureRecognizers = <NSArray: 0x1276c2690>; layer = <CALayer: 0x1276c20e0>; contentOffset: {0, 2}; contentSize: {320, 570}>
When a table is scrolled in vertical direction, the offset y value will be changed , x value will always be 0.
So in you case, you should refer to scrollView.contentOffset.y