Scrollers in uiwebview

I have a webview. I have enabled the webview scroll function. Scrollers are displayed when I view a web view.

But I need to show the scroll bar, even if I don’t scroll to indicate that scrolling is possible in this view.

Is it possible?

+3
source share
2 answers

well, maybe this is not possible, but if your goal is simply to let users know this scrollable view, you can just let them see it when you load your web pages, forcing webContent to scroll up from position.y + 100 to Up. you will get the UIScrollView used by your UIWebView and scroll it ...

in your UIViewController just add this:

- (void)webViewDidFinishLoad:(UIWebView *)wwwebView {
    UIScrollView *myUIWebScrollView = (UIScrollView*)[wwwebView.subviews objectAtIndex:0];
    [myUIWebScrollView setContentOffset:CGPointMake(0, 100) animated:NO];
    [self performSelector:@selector(scrollUp:) withObject:wwwebView afterDelay:0.4];
}

- (void)scrollUp:(UIWebView*)aWebView{
    UIScrollView *myUIWebScrollView = (UIScrollView*)[aWebView.subviews objectAtIndex:0];
    [myUIWebScrollView setContentOffset:CGPointMake(0, 0) animated:YES];

}

UIViewController UIWebViewDelegate, .h:

    @interface yourWebViewController : UIViewController <UIWebViewDelegate> {

    }

- (void)scrollUp:(UIWebView*)aWebView;
0

, , scroolbars , Apple.

-1

All Articles