开发者

Building my own image viewer in a UIWebView - replaceing flash image player in web pages

I'm building a n开发者_运维问答ew app and got a bit confused of "Howto" do it:

The concept is to build an image viewer (with capturing and responding to zoomin and scalling actions) which can be placed in a UIWebView (like a flash component which can view images in web pages).

My idea is to implement the image viewer based on UIScrollView and place it on front of the UIWebView (scrolling the webView will enforce the scrollView to change position relatively), in other words: the imageView is not a component of the webView (like a flash player is in web pages), but it looks and acts like it is.

Any suggestions of better idea for my problem or any improvement of it??!


I think that overlapping an UIScrollView on a UIWebView can be troublesome. Indeed, UIScrollView is pretty "greedy" when it comes to intercepting touch, and you would have possibly two of those (the other one being the UIWebView), competing. I.e., you could get mixed and varying results and to make things work seamlessly you would possibly need to customize how UIScrollView and UIWebView handle touch.

On the other hand, your ultimate goal is not entirely clear and it is difficult to come up with suggestions.

What I think of as a possible alternative way of doing what your are trying to, is modifying the content of your UIWebView by injecting in it some javascript/html so that the image viewer actually resides within the UIWebView and you rely on the UIWebView to do all the touch processing (pinching/zooming, etc), in conjunction with your javascript/html image viewer.

If you find this interesting, I would suggest looking at UIWebView's -loadHTMLString: selector, which allows to display whatever you like in a UIWebView (provided it's correct HTML/Javascript).

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜