How to refresh a UIWebView by a “pull down and release” gesture?

前端 未结 4 447
夕颜
夕颜 2020-12-25 08:52

I know that this is possible in the Tweetie for iPhone or the xkcd iPhone app, but they are using a table. Any idea if this can be done for a simple UIWebView a

4条回答
  •  佛祖请我去吃肉
    2020-12-25 09:18

    To retrieve scroll events on UIWebView I personnaly use this code to get the scrollview that is inside the UIWebView :

    - (void) addScrollViewListener
    {
        UIScrollView* currentScrollView;
        for (UIView* subView in self.myWebView.subviews) {
             if ([subView isKindOfClass:[UIScrollView class]]) {
                currentScrollView = (UIScrollView*)subView;
                currentScrollView.delegate = self;
            }
        }
    }
    

    It's working. You can also use it to call [(UIScrollView*)subView setContentOffset:offSet animated:YES]; The only problem may be not to pass Apple code checking. I don't know yet since I'm still in coding phase.

    Anyone tried that yet ?

提交回复
热议问题