开发者

Highlight menu in scrollview

开发者 https://www.devze.com 2023-02-08 23:33 出处:网络
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

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

Highlight menu in scrollview

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..

Highlight menu in scrollview


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

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号