saurabh jain
saurabh jain

Reputation: 19

How to show vertical or horizontal scroller on UIWebView?

I ma using UIWebView to some html content. And some time the data is more in width or height but I have fixed size UIWebView. So for user perspective I want to show scroller vertical or horizontal to indicate the user that there are some more content are available in this view. I am using [webView.scrollView flashScrollIndicators]; but it show scroller when I touch UIWebView. I want to show scroller by default. Can you suggest how to do this.

Upvotes: 0

Views: 2764

Answers (2)

Sham
Sham

Reputation: 475

Use the scroll view of the webviw like this:

   [(YOUR WEBVIEW).scrollView  setShowsHorizontalScrollIndicator:YES];
   [(YOUR WEBVIEW)scrollView  setShowsVerticalScrollIndicator:YES];

You can do one thing that ,use this

   - (void) webViewDidFinishLoad:(UIWebView *)webView){

        [(YOUR WEBVIEW).scrollView flashScrollIndicators];

     }

It Will show the scroll-indicator when downloading of the content will finish and user will easily understand that , there are more content on the bottom of the page.

Upvotes: 3

Stavash
Stavash

Reputation: 14304

The answer here is simple - you can't as it is against the human interface guidelines. There is a reason that the only way you can manually get them to show is by calling flashScrollIndicators. Apple didn't intend for you to show them so if you're going to implement this, it's going to be the hard way (subclassing or creating your own UIWebView).

Appearance and Behavior

When a scroll view first appears—or when users interact with it—vertical or horizontal scroll indicators flash briefly to show users that there is more content they can reveal. Other than the transient scroll indicators, a scroll view has no predefined appearance.

A scroll view responds to the speed and direction of gestures to reveal content in a way that feels natural to people. When users drag content in a scroll view, the content follows the touch; when users flick content, the scroll view reveals the content quickly and stops scrolling when the user touches the screen or when the end of the content is reached. A scroll view can also operate in paging mode, in which each drag or flick gesture reveals one app-defined page of content.

Source - iOS UI Element Usage Guidelines

Upvotes: 1

Related Questions