Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.0k views
in Technique[技术] by (71.8m points)

iphone uiwebview programmatic zoom

I'm developing an app that saves html files locally on iPhone file system, then load them in UIWebView. I want to be able to zoom or double tap programmatically on the UIWebView, I tried searching for javascript code, but I could only scroll.

I also tried the webview transform, but didn't work out for me. I found this method

sendAction:to:from:forEvent:

http://developer.apple.com/iphone/library/documentation/UIKit/Reference/UIApplication_Class/Reference/Reference.html#jumpTo_26

in the UIApplication class, that can send actions to controls.

Does anybody know how to send the double tap action programmatically to a UIWebView on a certain x,y?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

get the UIWebview's subview which is a UIScrollview

UIScrollView *sview = [[webview subviews] objectAtIndex:0];

Then use zoom methods on that.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...