开发者

Tap navigation bar to scroll to top

I have a really long UIWebView, and I need to add a way for the user to tap the UINavigationBar to 开发者_StackOverflowscroll to top (something like the Facebook app, where it's little glow when you tap).

How can I do this?


In iOS5, you can now access the UIScrollView directly, allowing you to scroll to top.

[webView.scrollView scrollRectToVisible:animated:]

That should take care of everything that you need.


You could use javascript to scroll the web view to the top. You could execute the javascript from the Objective-C side using

- (NSString *)stringByEvaluatingJavaScriptFromString:(NSString *)script
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜