0
我在這裏發現了類似的舊帖子: showsUserLocation does not display blue dot in iPhone 4.0爲什麼我不能在iOS中將mapView.showsUserLocation設置爲YES?
我有這樣的代碼:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
self.window = [[[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]] autorelease];
locationManager=[[CLLocationManager alloc]init];
[locationManager setDelegate:self];
[locationManager setDistanceFilter:kCLDistanceFilterNone];
[locationManager setDesiredAccuracy:kCLLocationAccuracyBest];
//[locationManager startUpdatingLocation];
mapView.showsUserLocation=YES;
NSLog(@"bool: %d", [mapView showsUserLocation]);
// Override point for customization after application launch.
self.viewController = [[[WhereamiViewController alloc] initWithNibName:@"WhereamiViewController" bundle:nil] autorelease];
self.window.rootViewController = self.viewController;
[self.window makeKeyAndVisible];
return YES;
}
爲什麼NSLog(@"bool: %d", [mapView showsUserLocation])
顯示0
,不1
?爲什麼我不能將它設置爲YES
?
你可以發佈'NSLog日誌(@「map:%@,%d」,mapView,[mapView showsUserLocation]);'? – Francesco 2012-04-21 15:48:04
你在哪裏分配了mapview ..? – 2012-04-21 15:52:47
您是在設備上還是在模擬器上測試? – jmstone617 2012-04-21 16:27:36