Comment ajouter un bouton sur les cartes Google dans iOS?

Je suis nouveau sur iOS Programmation et j'ai téléchargé les cartes google sdk pour iOS et suivi les instructions sur leur site ( comme indiqué dans ce lien
https://developers.google.com/maps/documentation/ios/start
)
et a été en mesure d'obtenir la carte dans mon application.

Maintenant, je suis en train d'ajouter un bouton sur l'écran en bas sur Google maps pour donnant la possibilité à l'utilisateur de revenir à l'écran précédent.

Je sais juste que UIButton est une sous-classe de UIView et nous pouvons faire un bouton apparaît sur une vue en rendant la sous-vue de cette classe. Auparavant iOS utilisé pour l'utilisation de Google Maps par défaut par MKMapView et j'ai vu des exemples dans les livres et sur Internet montrant des captures d'écran des applications où un bouton ou une zone de texte apparaît sur la carte. Mais maintenant, tout simplement en faisant glisser le bouton dans l'interface builder n'aide pas avec le SDK de google maps.

Voici mon code:

ViewController.h

#import <UIKit/UIKit.h>
#import <MapKit/MapKit.h>
#import <GoogleMaps/GoogleMaps.h>


@interface ViewController : UIViewController 

@property (weak, nonatomic) IBOutlet UIButton *btn;


@end

ViewController.m

#import "ViewController.h"
#import <MapKit/MapKit.h>
#import <GoogleMaps/GoogleMaps.h>
#import <CoreLocation/CoreLocation.h>


@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

Vous pouvez voir que dans les 2 dernières lignes, j'ai fait le bouton de la sous-vue de mapview et a tenté de mettre de l'avant. Mais cela n'a pas aidé. S'il vous plaît laissez-moi savoir ce que c'est que je suis absent ou s'il y a une autre façon de faire en utilisant une autre fonction.

Veuillez également vérifier la capture d'écran de la table de montage que j'ai créé afin que vous puissiez mieux comprendre ce que j'essaie de faire ici.

Comment ajouter un bouton sur les cartes Google dans iOS?

Grâce.

source d'informationauteur Manas