title: How to add a button on the Google maps in iOS?
body: <p>I am new to iOS Programming and I have downloaded the google maps sdk for iOS and followed the instruction on their website ( as shown in this link
  <a href="https://developers.google.com/maps/documentation/ios/start" rel="noreferrer">https://developers.google.com/maps/documentation/ios/start</a>
  ) 
  and was able to get the map in my application.</p>
  
  <p>Now I am trying to add a button on the screen at the bottom over Google maps for giving an option to the user to go back to the previous screen. </p>
  
  <p>I just know that UIButton is a subclass of UIView and we can make a button appear on a view by making it the sub view of that class. Previously iOS used to use Google Maps by default by MKMapView and I have seen examples in books an on the Internet showing screen shots of apps where a button or a text box would appear on the map. But now just dragging the button in the interface builder doesn't help with the SDK of google maps.</p>
  
  <p>Here is my code:</p>
  
  <p><strong>ViewController.h</strong></p>
  
  <pre><code>#import &lt;UIKit/UIKit.h&gt;
  #import &lt;MapKit/MapKit.h&gt;
  #import &lt;GoogleMaps/GoogleMaps.h&gt;
  
  
  @interface ViewController : UIViewController 
  
  @property (weak, nonatomic) IBOutlet UIButton *btn;
  
  
  @end
  </code></pre>
  
  <p><strong>ViewController.m</strong></p>
  
  <pre><code>#import "ViewController.h"
  #import &lt;MapKit/MapKit.h&gt;
  #import &lt;GoogleMaps/GoogleMaps.h&gt;
  #import &lt;CoreLocation/CoreLocation.h&gt;
  
  
  @interface ViewController ()
  
  @end
  
  @implementation ViewController
  {
      GMSMapView *mapView_;
  }
  
  - (void)viewDidLoad
  {
      [super viewDidLoad];
      // Do any additional setup after loading the view, typically from a nib.
  }
  
  - (void)didReceiveMemoryWarning
  {
      [super didReceiveMemoryWarning];
      // Dispose of any resources that can be recreated.
  }
  
  - (void)loadView
  {
      CLLocationManager *locationManager = [[CLLocationManager alloc] init];
      locationManager.distanceFilter = kCLDistanceFilterNone;
  
      locationManager.desiredAccuracy = kCLLocationAccuracyKilometer;
      [locationManager startUpdatingLocation];
  
      //Latitude and longitude of the current location of the device.
      double lati = locationManager.location.coordinate.latitude;
      double longi = locationManager.location.coordinate.longitude;
      NSLog(@"Latitude = %f", lati);
      NSLog(@"Longitude = %f", longi);
  
      CLLocation *myLocation = [[CLLocation alloc] initWithLatitude:lati longitude:longi];
  
      // Create a GMSCameraPosition that tells the map to display the coordinate
  
      GMSCameraPosition *camera = [GMSCameraPosition cameraWithLatitude:lati
                                                              longitude:longi
                                                                   zoom:11.5];
  
      mapView_ = [GMSMapView mapWithFrame:[[UIScreen mainScreen] bounds] camera:camera];
      mapView_.myLocationEnabled = YES;
      self.view = mapView_;
  
      // Creates a marker in the center of the map.
      GMSMarker *marker = [[GMSMarker alloc] init];
      marker.position = CLLocationCoordinate2DMake(lati, longi);
      marker.title = @"It's Me";
      marker.snippet = @"My Location";
      marker.map = mapView_;
  
      [mapView_ addSubview:_btn];
      [mapView_ bringSubviewToFront:_btn];
  
  }
  @end
  </code></pre>
  
  <p>You can see that in the last 2 lines I have made the button the subview of mapview and tried to bring it front. But this didn't help. Please let me know what is it that I am missing or if there is another way to do this by using some other function.</p>
  
  <p>Please also do check the screenshot of the storyboard which I have created so that you can understand better what I am trying to do here.</p>
  
  <p><img src="https://i.stack.imgur.com/srLp4.png" alt="Screenshot of the storyboard"></p>
  
  <p>Thanks.</p>