0
votes

I created a viewcontroller with Google maps , but I have no need to insert the card in full size viewcontroller, and I got it ( the new view I added a class GMSMapView) but I need to put this map markers . Example of my marker

    CLLocationCoordinate2D position2 = CLLocationCoordinate2DMake(59.957069, 30.323013);
GMSMarker *london2 = [GMSMarker markerWithPosition:position2];
london2.title = @"my office";
london2.snippet = @"description";
london2.map = mapView_;

This is my code

- (void)viewDidLoad {
    [super viewDidLoad];
    self.mapView_.mapType = kGMSTypeNormal;
 self.mapView_.settings.compassButton = YES;
 self.mapView_.settings.myLocationButton = YES;
  self.mapView_.delegate = self;
 [GMSServices provideAPIKey:@"###"];
   GMSCameraPosition *camera = [GMSCameraPosition cameraWithLatitude:-33.86
                                                            longitude:151.20
                                                                 zoom:1];
    mapView_ = [GMSMapView mapWithFrame:CGRectZero camera:camera];

    mapView_.myLocationEnabled = YES;
    mapView_.settings.compassButton = YES;
    mapView_.settings.myLocationButton = YES;
    //self.view = mapView_;

GMSMarker *london2 = [GMSMarker markerWithPosition:position2];
london2.title = @"my office";
london2.snippet = @"description";
london2.map = mapView_;

Question - if I add a line self.view = mapView_; the card is reflected on the whole screen with the right markers to me , if I remove , it is reflected without markers , but my desired size - how to fix it ( make a map of the desired size and markers )

1

1 Answers

0
votes

You can change your self.view = mapView_;

to the following code:

mapView.frame = CGRectMake(YOUR_MAP_X, YOUR_MAP_Y, YOUR_MAP_WIDTH, YOUR_MAP_HEIGHT);
[self.view addSubview:mapView_];

Your mapView_ will be a subview of your main UIView, instead of occupying the entire screen.