views:

32

answers:

1

Hi everyone, I have an iOS app that displays content from a sqlite db in a UIWebView (theres a reason I am using the UIWebView over say a ScrollView, and it is for some CSS). I want to add a feature to my app that will make it easier to read from. I want to have a button, that initiates an autoscroll function where the UIWebView begins to scroll at a certain set speed when fired.

Pretty simple I imagine, I just have no clue of where to begin. Does anyone know of any tutorials about this topic? Can anyone give me some keywords that I can do research on to get a better understanding of how I need to set this up? Any help here is appreciated!!

A: 

You can use the NSTimer class to get a notification at certain interval and do animated scroll of the UIWebView.

Note that you will actually have to put the UIWebView in an UIScrollView in order to get the scrolling support. (The alternative is to make the UIWebView rectangle bigger than the viewport and animate its offset - which is what UIScrollView does, except better)

Update: To animate the offset of the UIWebView in the UIScrollView, use setContentOffset:animated:. You will have to figure out the animation time interval, in order to set your NSTimer interval close to it, so that the scrolling looks smooth.

Franci Penov
Thanks for your answer. What exactly do you mean by animating the offset? Thanks
Jeff