How to draw a line on UIWebView (iphone)
I have a UIWebView with a custom map (vector image/svg) loaded. I would like to draw lines on that image. The image can be zoomed in/out so the line has to respond to that as well (which is why having another uiview as a subview won't work for me). What is the easiest way to do this?
Tha开发者_StackOverflow社区nks!
There isn't really an "easy" way to do this. UIWebView
is just a viewer, it gives you no control over editing or anything else.
If you want full control (over a map, or anything else you can load in a UIWebview), you have to implement it another way (using MKMapView or whatever the API is (no experience with it)). For instance, if you want to do a real PDF viewer (page flipping, showing annotations, etc) you use CGPDFDocument
and associated APIs, not UIWebView
.
MKMapView's class reference can be found here
Currently there is no "real" way todo this, a work around would be (if you don't need zooming) to put a UIView
on top of the UIWebView
, on this view you could draw.
There are some work around to zoom the UIView
same way as the UIWebView
, but these are all workarounds that do not work well.
Also CGPDFDocument
are no real workarounds, as you there also have really limited methods to draw etc.
Best option would be to use a MKMapView
with overlay.
精彩评论