Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to implement iOS Google Maps SDK

I just have a question and can't seem to find it anywhere.

I"m new to iOS development and trying to use Google Maps inside my application.

I went thru the example they give you here.

    #import "DemoViewController.h"
#import <GoogleMaps/GoogleMaps.h>

@implementation DemoViewController {
  GMSMapView *mapView_;
}

- (void)loadView {
  GMSCameraPosition *camera = [GMSCameraPosition cameraWithLatitude:1.285
                                                          longitude:103.848
                                                               zoom:12];
  mapView_ = [GMSMapView mapWithFrame:CGRectZero camera:camera];
  self.view = mapView_;
}

@end

But as you can see the they set self.view = mapView_; and the UIView class doesn't have a view function.

I want the map to be inside a UIView I have that is inside another ViewController

Did I lose you yet? Either ways here is a picture. enter image description here

So inside of the view (or whitespace) I want the map to load.

Thanks guys for the help.

like image 496
Claud Avatar asked Mar 09 '13 02:03

Claud


People also ask

Is Google Maps iOS SDK free?

The Maps SDK for iOS uses a pay-as-you-go pricing model.

Can iOS use Google Maps?

With the Maps SDK for iOS, you can add maps based on Google maps data to your application. The SDK automatically handles access to the Google Maps servers, map display, and response to user gestures such as clicks and drags. You can also add markers, polylines, ground overlays and info windows to your map.


1 Answers

So you've got a GMSMapView. And you can make one view a subview of another in the interface with addSubview:. I wouldn't do it in loadView if I were you, though. viewDidLoad is the earliest good opportunity.

I think your real problem is that you're way ahead of yourself. You're trying to do this without know how views work, how view controllers work, etc. I recommend you take a deep breath and learn about iOS programming before you jump in with all four feet. Otherwise you don't know what your code (or Google's code) even means.

like image 62
matt Avatar answered Sep 21 '22 14:09

matt