This repository has been archived by the owner on Aug 8, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Using Mapbox iOS SDK in an Interface Builder storyboard
Minh Nguyễn edited this page Oct 23, 2015
·
4 revisions
- Drag a
UIView
out from the Object library into aUIViewController
in a storyboard. - In the Identity inspector, set the custom class to
MGLMapView
. - In the Attributes inspector, optionally set a custom style URL (in the form
mapbox://styles/STYLE_ID
), initial coordinates, and initial zoom level. -
(Optional) Set up the
MGLMapView
’s Auto Layout constraints. - Build and run.
If your app needs to manipulate the map after launch, hook the MGLMapView
up to an outlet:
- Switch to the Assistant Editor.
- Control-drag from the map view in Interface Builder to your view controller’s implementation.
- Import Mapbox’s umbrella header into that file.
The resulting outlet declaration should look something like:
// ViewController.m
#import "MapboxGL.h"
@interface ViewController : UIViewController
@property (strong) IBOutlet MGLMapView *mapView;
@end
// ViewController.swift
import MapboxGL
class ViewController: UIViewController {
@IBOutlet var mapView: MGLMapView!
}
Workflow: Code, Makefile, CMake, Xcode, ccache, Debugging, CI, JS/Native, Code Generation, Versions & Tagging, Contributing, Troubleshooting
Architecture: Threads, Immutability, Expressions, Text Rendering, Collision Detection, CJK Text
Rendering: OpenGL, Coordinate Systems
Android: checkstyle, APK Size, 4→5, 5→6, 6→7, Symbolication
iOS/macOS: 3→4
Releasing: iOS, macOS, Merging back
Misc: Terminology