Created
May 27, 2015 19:57
-
-
Save msingleton/f5c6aa12ab761d42fdb7 to your computer and use it in GitHub Desktop.
MGLMapView
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ViewController: UIViewController { | |
var mapView: MGLMapView? | |
init() { | |
super.init(nibName: nil, bundle: nil) | |
MGLAccountManager.setMapboxMetricsEnabledSettingShownInApp(true) | |
mapView = MGLMapView(frame: CGRectNull, accessToken: "FOO") | |
view.addSubview(mapView!) | |
initConstraints() | |
} | |
required init(coder aDecoder: NSCoder) { | |
fatalError("init(coder:) has not been implemented") | |
} | |
func initConstraints() { | |
mapView!.setTranslatesAutoresizingMaskIntoConstraints(false) | |
view.addConstraints([ | |
NSLayoutConstraint(item: mapView!, attribute: .Top, relatedBy: .Equal, toItem: view, attribute: .Top, multiplier: 1, constant: 0), | |
NSLayoutConstraint(item: mapView!, attribute: .Bottom, relatedBy: .Equal, toItem: view, attribute: .Bottom, multiplier: 1, constant: 0), | |
NSLayoutConstraint(item: mapView!, attribute: .Leading, relatedBy: .Equal, toItem: view, attribute: .Leading, multiplier: 1, constant: 0), | |
NSLayoutConstraint(item: mapView!, attribute: .Trailing, relatedBy: .Equal, toItem: view, attribute: .Trailing, multiplier: 1, constant: 0) | |
]) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment