File tree 2 files changed +40
-0
lines changed
2 files changed +40
-0
lines changed Original file line number Diff line number Diff line change @@ -181,5 +181,12 @@ let listOfExamples: [NamedController] = [
181
181
controller: CustomRoutingProviderViewController . self,
182
182
storyboard: nil ,
183
183
pushExampleToViewController: true
184
+ ) ,
185
+ (
186
+ name: " Navigation View " ,
187
+ description: " Demonstrates how to use NavigationView. " ,
188
+ controller: NavigationViewViewController . self,
189
+ storyboard: nil ,
190
+ pushExampleToViewController: true
184
191
)
185
192
]
Original file line number Diff line number Diff line change
1
+ import UIKit
2
+ import MapboxCoreNavigation
3
+ import MapboxNavigation
4
+ import MapboxDirections
5
+
6
+ class NavigationViewViewController : UIViewController {
7
+
8
+ var navigationView : NavigationView !
9
+
10
+ override func viewDidLoad( ) {
11
+ super. viewDidLoad ( )
12
+
13
+ navigationView = NavigationView ( frame: view. bounds)
14
+ navigationView. autoresizingMask = [ . flexibleWidth, . flexibleHeight]
15
+
16
+ let navigationViewportDataSource = NavigationViewportDataSource ( navigationView. navigationMapView. mapView,
17
+ viewportDataSourceType: . raw)
18
+ navigationView. navigationMapView. navigationCamera. viewportDataSource = navigationViewportDataSource
19
+ navigationView. navigationMapView. navigationCamera. follow ( )
20
+
21
+ view. addSubview ( navigationView)
22
+
23
+ navigationView. bottomBannerContainerView. isHidden = false
24
+ navigationView. bottomBannerContainerView. heightAnchor. constraint ( equalToConstant: 150.0 ) . isActive = true
25
+ navigationView. bottomBannerContainerView. backgroundColor = . white
26
+ navigationView. isBottomBannerContainerViewExpandable = true
27
+ navigationView. bottomBannerContainerViewOffset = 50.0
28
+
29
+ navigationView. topBannerContainerView. isHidden = false
30
+ navigationView. topBannerContainerView. heightAnchor. constraint ( equalToConstant: 50.0 ) . isActive = true
31
+ navigationView. topBannerContainerView. backgroundColor = . white
32
+ }
33
+ }
You can’t perform that action at this time.
0 commit comments