Google maps Annotation ios...
- Create the New Xcode in specific folder.
- Open Terminal by pressing Command+Space Button
- Type the cd ~/Desktop/NaniMaps
- Type the Pod init
- Type this pico Podfile (This was created in your Xcode folder).
- Goto Browser and search for googlemaps SDK for iOS
- Then Open the Getting Started in the filtered results which was showen bellow.
- In Getting started webpage look for = source 'https://github.com/CocoaPods/Specs.git' and copy it.
- Goto Terminal and plate the copied content above the target ‘NaniMaps’ do just like bellow… Example:-source 'https://github.com/CocoaPods/Specs.git' target 'NaniMaps’ do.
- Again goto browser and copy the (pod ‘GoogleMaps' pod ‘GooglePlaces’).
- Goto Terminal and paste the copied content below the #Pods for NaniMap For Example # Pods for NaniMaps
- pod ‘GoogleMaps’
- pod ‘GooglePlaces'
- Press Ctrl+O to Save.
- Press Ctrl+X to Exit and Press Enter.
- Type the pod install command to install pods to our project.
- Goto your project folder then you will find one workspace file open it and check pods are correctly installed are not…
- Goto browser and press the GET KEY then give your project name then you get one window in that press the goto console.
- In that window open credentials and select the edit option… and the give your Xcode bundler identifier. and copy the Key Like as AIzaSyA0VTc9RJ2LcJRoysRq3WtnSDp1q7wMLdY.
- Again goto Getting Started Page and copy the bellow code:
- [GMSServices provideAPIKey:@"YOUR_API_KEY”];
- [GMSPlacesClient provideAPIKey:@"YOUR_API_KEY”];
- Open the Xcode and in that open the AppDelegate.h and import the
- #import <GoogleMaps/GoogleMaps.h>
- #import <GooglePlaces/GooglePlaces.h>
- Open the Xcode and in that open the AppDelegate.m and paste the content in did finishlaunch:
- [GMSServices provideAPIKey:@"YOUR_API_KEY”];
- [GMSPlacesClient provideAPIKey:@"YOUR_API_KEY”];
- Import the same files in viewController.h also.
- Goto AppDelegate.m file and type the following-
- -(BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
- [GMSServices provideAPIKey:@"AIzaSyA0VTc9RJ2LcJRoysRq3WtnSDp1q7wMLdY”];
- [GMSPlacesClien provideAPIKey:@"AIzaSyA0VTc9RJ2LcJRoysRq3WtnSDp1q7wMLdY”];return YES;}
- Goto Getting Started page and copy the following code in browser:
- (void)loadView { - // 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];
- GMSMapView *mapView = [GMSMapView mapWithFrame:CGRectZero 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(-33.86, 151.20);
//marker.position = camera.target;(Optional for the market.position)
marker.title = @"Sydney"; - marker.snippet = @"Australia";
- marker.map = mapView;
- }
No comments:
Post a Comment