4

I have a map in my app that start as a small map and becomes large after the user clicks it.

Here it is in iOS 10 and iOS 11 side by side (small)

enter image description here

When the user taps the map, it becomes full screen and appears as such (again iOS 10 - iOS 11):

enter image description here

AS you can see, in iOS 11 it seems to zoom in for some reason.

Here is the function related to tapping the map:

@objc fileprivate func mapTap(sender: UITapGestureRecognizer){
    self.mapViewHeight.constant = self.view.frame.height + 2
    self.mapViewToTop.constant = -73
    self.mapView.isScrollEnabled = true
    self.mapView.isZoomEnabled = true
    self.scrollView.isScrollEnabled = false
    UIApplication.shared.hideStatusBar(false)

    UIView.animate(withDuration: 0.35, delay: 0, usingSpringWithDamping: 1.0, initialSpringVelocity: 0, options: UIViewAnimationOptions.curveLinear, animations: {
        self.view.layoutIfNeeded()
        self.scrollView.layer.zPosition = 10
    }, completion: {
        done in
        self.mapXButtonTrailing.constant = 20
        self.mapXButton.layer.zPosition = 11
        UIView.animate(withDuration: 0.2, delay: 0, options: .curveEaseOut, animations: {
            self.view.layoutIfNeeded()
        }, completion: nil)})

}

And finally: Clicking the X button and undoing the above results in: enter image description here

This is slightly different then when it was initially in the small state, as the iOS 11 version has again done something with the zoom/set region by becoming slightly zoomed out.

I should note, that to make the initial small load of the map render the same region correctly for iOS 11 and iOS 10 I had to do the following:

        self.region = MKCoordinateRegion()
        self.region.center = location
        if #available(iOS 11.0, *){
            self.region.span.latitudeDelta = delta
            self.region.span.longitudeDelta = delta
        }else{
            self.region.span.latitudeDelta = delta * 3.5
            self.region.span.longitudeDelta = delta * 3.5
        }

The iOS 11 version once again has something occurring different then how I used to have it for iOS 10.

daredevil1234
  • 1,303
  • 1
  • 10
  • 34

0 Answers0