Skip to content

Commit

Permalink
Move Examples/SearchExample.xcworkspace SearchUI attribution and logo…
Browse files Browse the repository at this point in the history
… to top left (out of SearchUI) #165 (#170)

### Description
Fixes #165

- Update SearchExample > Integrate SearchUI module to demonstrate correct attribution on a Mapbox MapView when using the SearchUI 
- Attribution guide: https://docs.mapbox.com/help/getting-started/attribution/#mapbox-maps-sdk-for-ios

### Checklist
- ~[ ] Update `CHANGELOG`~

| Before | After | After (iPhone SE) |
| -- | -- | -- |
|  ![Simulator Screen Shot - iPhone 14 Pro - 2024-02-07 at 14 14 06](https://github.com/mapbox/mapbox-search-ios/assets/384288/727d2952-488e-41b4-a263-6e098460a428) | ![Simulator Screen Shot - iPhone 14 Pro - 2024-02-07 at 14 09 12](https://github.com/mapbox/mapbox-search-ios/assets/384288/4f553bf3-56ba-4554-8037-5c298b925385) | ![Simulator Screen Shot - iPhone SE (2nd generation) - 2024-02-07 at 14 19 18](https://github.com/mapbox/mapbox-search-ios/assets/384288/0ed6e44b-8dfa-486a-8332-334ac608fb34) |
  • Loading branch information
aokj4ck authored Feb 9, 2024
1 parent 910b2d1 commit a28aee5
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions Examples/SearchExamples/SimpleUISearchViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,25 @@ class SimpleUISearchViewController: MapsViewController {
let cameraOptions = CameraOptions(center: .sanFrancisco, zoom: 15)
mapView.camera.fly(to: cameraOptions, duration: 1, completion: nil)

let horizontalMargin: CGFloat = 4
mapView.ornaments.options.logo = LogoViewOptions(
position: .topLeading,
margins: CGPoint(x: horizontalMargin, y: 0)
)

mapView.ornaments.options.attributionButton = AttributionButtonOptions(
position: .topLeading,
margins: CGPoint(x: 0, y: 4)
)

let scalarX = mapView.ornaments.logoView.bounds.maxX + 12
mapView.ornaments.options.scaleBar = ScaleBarViewOptions(
position: .topLeading,
margins: CGPoint(x: scalarX, y: 0),
visibility: .visible,
useMetricUnits: false
)

searchController.delegate = self
addChild(panelController)
}
Expand Down

0 comments on commit a28aee5

Please sign in to comment.