Select to view content in your preferred language

attributionTopAnchor and safeAreaLayoutGuide

524
1
10-19-2017 01:33 PM
WorthSparks
Regular Contributor

I am preparing our app for iPhone X, which makes use of the new safeAreaLayoutGuide to keep controls above iPhone X's bottom indicator for accessing the Home screen. Currently, AGSGeoView.attributionTopAnchor falls below UIView.safeAreaLayoutGuide.bottomAnchor. Two questions:

  1. Is there a change planned for Esri attribution with respect to iPhone X?
  2. What is the best way in code to position an app's controls above both anchors (AGSGeoView.attributionTopAnchor and UIView.safeAreaLayoutGuide.bottomAnchor) for all device types and orientations?
Tags (2)
0 Kudos
1 Reply
MarkDostal
Esri Regular Contributor

Thank you for your question!  Yes, we have fixed the attribution view on the iPhone X for our next release.  As for the best way to position controls, you should only have to worry about the GeoView's attributionTopAnchor, as the attribution view should be positioned correctly:

```

var segmentedControl: UISegmentedControl = UISegmentedControl(items: ["One", "Two", "Three"])

view.addSubview(segmentedControl)
segmentedControl.translatesAutoresizingMaskIntoConstraints = false
segmentedControl.leadingAnchor.constraint(equalTo: mapView.leadingAnchor, constant: 0).isActive = true
segmentedControl.trailingAnchor.constraint(equalTo: mapView.trailingAnchor, constant: 0).isActive = true

// The "-4" gives a bit of space between the segmented control and the top of the attribution view
segmentedControl.bottomAnchor.constraint(equalTo: mapView.attributionTopAnchor, constant: -4 ).isActive = true

```

Here's a video of it in action (with the forthcoming SDK version):

If you have any more questions, please let us know.

Mark