Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Try this in your project:</p> <pre><code>// // testViewController.m // maps // // Created by Millén on 2013-02-25. // Copyright (c) 2013 JamWeb. All rights reserved. // #import "testViewController.h" #import &lt;GoogleMaps/GoogleMaps.h&gt; @interface testViewController () @property(nonatomic, strong) GMSMapView *gMapView; @end @implementation testViewController { CLLocation *oldLocation; } -(void)loadView { CLLocationDegrees lat = 59.34702; CLLocationDegrees lon = 18.04053; GMSCameraPosition *camera = [GMSCameraPosition cameraWithLatitude:lat longitude:lon zoom:10]; self.gMapView = [GMSMapView mapWithFrame:CGRectZero camera:camera]; self.gMapView.myLocationEnabled = YES; self.view = self.gMapView; [self updateLocation]; } - (void)viewDidLoad { [super viewDidLoad]; // Start locationmanager locationManager = [[CLLocationManager alloc] init]; locationManager.desiredAccuracy = kCLLocationAccuracyBest; locationManager.delegate = self; [locationManager startUpdatingLocation]; } - (IBAction)updateLocation { [locationManager startUpdatingLocation]; } - (void)locationManager:(CLLocationManager *)manager didUpdateLocations:(NSArray *)locations { CLLocation *location = [locations lastObject]; /* if(!oldLocation) { oldLocation = location; } if (![location isEqual:oldLocation]) { GMSCameraPosition *camera = [GMSCameraPosition cameraWithLatitude: location.coordinate.latitude longitude: location.coordinate.longitude zoom:7]; mapView_ = [GMSMapView mapWithFrame:CGRectZero camera:camera]; mapView_.myLocationEnabled = YES; self.view = mapView_; oldLocation = location; [locationManager stopUpdatingLocation]; } */ NSLog(@"lat%f - lon%f", location.coordinate.latitude, location.coordinate.longitude); } - (void)didReceiveMemoryWarning { [super didReceiveMemoryWarning]; // Dispose of any resources that can be recreated. } @end </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload