1
I’m developing an application where I need to insert a map of an internal location (so apple’s map view has not registered ) I wonder if it has how to mount a mapView (mounting the internal location ) or if I do not have if I can insert an Imgview and allow zooming , because I have the plant in jpg ? Thank you
Current code :
class MapasViewController: UIViewController, UIScrollViewDelegate {
@IBOutlet weak var imgMapa: UIImageView! // *** Declara imgView
@IBOutlet weak var scrollView: UIScrollView!
func viewForZoomingInScrollView(scrollView: UIScrollView) -> UIView? {
return imgMapa
}
override func viewDidLoad() {
super.viewDidLoad()
print("*** LOG : TELA DE MAPAS CARREGADA ***")
let width: CGFloat = imgMapa.image!.size.width
let height: CGFloat = imgMapa.image!.size.height
scrollView.minimumZoomScale = 1.0
scrollView.maximumZoomScale = 6.0
scrollView.contentSize = CGSizeMake(width, height)
scrollView.delegate = self
scrollView.zoomScale = 1.0
}
}
Friend I realized what you said... If you do not set the image it closes the app, if I set the image does not appear, it turns white, I put the settings you mentioned in the didload, right? you know how I can fix ?
– Augusto Furlan
added the code for better understanding
– Augusto Furlan
Try putting in the
viewDidAppear
. The image needs to be set, otherwise the moment you getimgMapa.image
, will come back void.– Paulo Rodrigues
Friend solved, had forgotten to put the view inside the Uiview, thanks
– Augusto Furlan