Highlight menu in scrollview
What I need help with is: I want the menu to be on the scrollview and when I swipe it, the menu should become highlighted. For example; Menu is default color, once it is swiped, the color shall change to red.
I'm not to su开发者_Python百科re how I can do this, can anyone help?
UPDATE:
Basically what i mean to say is...
m trying to HILGHLIGHT the view that i scroll...
for example
the 1st image on scroll view is totally visible..i want this image to be highlighted.
then when scroll the next image...
2nd image shud come up and get highlighted..
Have you read UIScrollViewDelegate? You could use
- (void)scrollViewDidScroll:(UIScrollView *)scrollView {
CGFloat offset = scrollView.contentOffset.x;
for (UIView *eachView in myViews) {
CGFloat dif = offset - eachView.frame.origin.x;
if (dif > 0 && offset < eachView.frame.size.width)
eachView.highlighted = YES;
else
eachView.highlighted = NO;
}
}
note: this is not optimized... just an example
精彩评论