0
嘿傢伙, 我想調用更新方法,但它不工作,任何想法?方法沒有被調用(核心位置)可可觸摸
#import "TrackerViewController.h"
@implementation TrackerViewController
-(IBAction)updateButton:(id)sender{
[self update];
}
-(void)update{
locmanager = [[CLLocationManager alloc] init];
[locmanager setDelegate:self];
[locmanager setDesiredAccuracy:kCLLocationAccuracyBest];
[locmanager startUpdatingLocation];
}
-(void)viewDidLoad {
[self update];
}
- (void)locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation
{
CLLocationCoordinate2D loc = [newLocation coordinate];
latitude.text = [NSString stringWithFormat: @"%f", loc.latitude];
longtitude.text = [NSString stringWithFormat: @"%f", loc.longitude];
}
- (void)locationManager:(CLLocationManager *)manager didFailWithError:(NSError *)error
{
}