iPhone - 使UIWebView子视图滚动到顶部,当用户触摸状态栏(iOS 4) [英] iPhone - Make a UIWebView subview scrolling to top when user touches the status bar (iOS 4)
问题描述
我有一个mainView包含:
I have a mainView that contains :
- 一个分页的scrollView,
- 关闭按钮
,scrollView的每个页面都包含一个包含webView
and each page of the scrollView contains a subview that contains a webView.
用户可以从左到右从页面到页面,并向上和向下滚动每个webView。
The user can go left to right from pages to pages, and scroll up and down each webView.
但是...当用户触摸状态栏时,如何使当前显示的webView滚动到顶部?
But... how can I make the currently displayed webView scroll to top when the user touches the status bar ?
EDIT:
for iOS4当然。
EDIT : for iOS4 of course.
推荐答案
[yourPaginatedScrollView setScrollsToTop:NO];
[(UIScrollView *)[yourWebView.subviews objectAtIndex:0] setScrollsToTop:YES];
第一行是重要的,否则两个scrollview将被赋值=> iOS不能真正选择,因此当您触摸状态栏时,它将决定没有scrollview滚动到顶部。
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.
这篇关于iPhone - 使UIWebView子视图滚动到顶部,当用户触摸状态栏(iOS 4)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!