shj997
shj997

Reputation: 29

Create smaller map view using Google Maps SDK Swift

I am wondering if anyone knows how to code a smaller window of Google Maps using their SDK in Swift? The examples given result in a view that takes up the entire screen. I want mine to be smaller to allow for other content. Thanks.

https://i.sstatic.net/6CIGk.png https://i.sstatic.net/xSUO3.png

Upvotes: 0

Views: 1067

Answers (2)

Noura Aziz
Noura Aziz

Reputation: 57

Create ContainerView instead of UIView, then add the map to the embedded view controller of container view. It should be work

Upvotes: 0

Andres Sosa Martinez
Andres Sosa Martinez

Reputation: 149

You're supposed to create a view in your storyboard and set its class to GMSMapView, then declare an IBOutlet for the view of the type GMSMapView I named it myMapView (dont forget to link it) then you add this lines to your ViewController inside the viewDidLoad function:

let camera = GMSCameraPosition.cameraWithLatitude(4.739001, longitude: -74.059616, zoom: 17)
let myGSMMap = GMSMapView.mapWithFrame(CGRectZero, camera: camera)
myMapView = myGSMMap

Upvotes: 0

Related Questions