Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding Scrollbar to UIScrollView Subclass #8

Open
ghost opened this issue Dec 16, 2012 · 0 comments
Open

Adding Scrollbar to UIScrollView Subclass #8

ghost opened this issue Dec 16, 2012 · 0 comments

Comments

@ghost
Copy link

ghost commented Dec 16, 2012

Hey,

I tried to implement the VerticalScrollBar in a UIScrollViewSubclass with the following code:

  • (void) initVerticalScrollBarForScrollView
    {
    // NOTE: Make sure vertical scroll bar is on top of the scroll view
    [self setVerticalScrollBar:[[WKVerticalScrollBar alloc] initWithFrame:self.frame]];
    [self.verticalScrollBar setScrollView:self];

    [self addSubview:self.verticalScrollBar];
    [self bringSubviewToFront:self.verticalScrollBar];

    [self setAccessoryView:[[WKAccessoryView alloc] initWithFrame:CGRectMake(0, 0, 65, 30)]];
    [self.accessoryView setForegroundColor:[UIColor colorWithWhite:0.2f alpha:1.0f]];
    [self.verticalScrollBar setHandleAccessoryView:self.accessoryView];
    }

The ScrollBar is shown correctly but when I scroll vertically the scrollbar doesn't scroll and stays sticky at the top of the UIScrollView.

I have implemented WKVerticalScrollView before, inside an UIViewController and it worked perfectly. Why stays the scrollbar sticky at the top, when using it inside of UIScrollView subclass?
Any ideas?

Greetz!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

0 participants