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!!
You can use the
NSTimerclass to get a notification at certain interval and do animated scroll of theUIWebView.Note that you will actually have to put the
UIWebViewin anUIScrollViewin order to get the scrolling support. (The alternative is to make theUIWebViewrectangle bigger than the viewport and animate its offset – which is whatUIScrollViewdoes, except better)Update: To animate the offset of the
UIWebViewin theUIScrollView, usesetContentOffset:animated:. You will have to figure out the animation time interval, in order to set yourNSTimerinterval close to it, so that the scrolling looks smooth.