iosobjective-cgoogle-mapsios7

My location button not appearing in view (Google maps SDK, ios)


Here is my mapViewController.m file:

@interface MapViewController()

@property (strong, nonatomic) GMSMapView* mapView;
@property (weak, nonatomic) IBOutlet GMSMapView *subView;

@end

@implementation MapViewController

    - (void) viewDidLoad{
    // Create a GMSCameraPosition that tells the map to display the
    // coordinate -33.86,151.20 at zoom level 6.
    GMSCameraPosition *camera = [GMSCameraPosition cameraWithLatitude:-33.86
                                                        longitude:151.20
                                                             zoom:6];

    _mapView = [GMSMapView mapWithFrame:self.view.bounds camera:camera];

    _mapView.myLocationEnabled = YES;

    _mapView.settings.compassButton = YES;
    _mapView.settings.myLocationButton = YES;

    [self.subView addSubview:_mapView];
}

My problem is that the my location button doesn't appear, any help appreciated! :) Please tell me if you need to see more of my project.


Solution

  • Solved it. Problem was that I added the mapview as a subview, and not to the outlet view. Now its fixed.