views:

91

answers:

2

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 as well? I'm aware of the Javascript suggestions in this SO question, but what about making that natively?

A: 

In my own implementation of the 'pull to refresh' view and in an open source option, EGOTableViewPullRefresh, the view relies on tracking the UIScrollView with the delegate methods. I imagine this is the case in the xkcd app.

There is no such tracking available with the UIWebView, so it rules out that option.

I guess what you could try, and it would be very complicated, is override touchesBegan: and touchesMoved: and try to track a finger that's scrolling the UIWebView, then decide whether it's pulling the view down or if the user is just scrolling the page content.

Tom Irving
So you mean that first, I need to know (by Javascript, I guess) if I am on the top of the page, and then I should start checking if the user keeps "pulling down" with the help of touchesMoved, right?
Irene
Yup, check the position in touchesBegan: then decide whether or not to continue processing in touchesMoved:. That's how I would do it.
Tom Irving