I have a mainView that contains :
- a paginated scrollView,
- a page Control
- a close button
and each page of the scrollView contains a subview that contains a webView.
The user can go left to right from pages to pages, and scroll up and down each webView.
But... how can I make the currently displayed webView scroll to top when the user touches the status bar ?
EDIT :
for iOS4 of course.
[yourPaginatedScrollView setScrollsToTop:NO];
[(UIScrollView *)[yourWebView.subviews objectAtIndex:0] setScrollsToTop:YES];
The first line is important too else two scrollviews will be assigned => iOS can't really choose, so it'll decide no scrollview scrolls to top when you touch the status bar.
If you are building your application against iOS 5 base SDK, you can use now public property "scrollView" in UIWebView, using that you can scroll to whatever offset you desire to.
If you are building for SDK < 5.0, it can be done in another way using HTML features. You can use Anchor tag somewhere at the top in your HTML code, at the very beginning just after tag begins, include this anchor:
< A NAME="top_of_page">
Now when user taps on the the status bar, make this action trigger:
<A HREF="#top_of_page">
Somehow, not pretty sure how though!
Perhaps by using:
- (NSString *)stringByEvaluatingJavaScriptFromString:(NSString *)script
???