简体   繁体   中英

Why does my blue dot (user location) in MapKit move?

I have several questions regarding the blue dot (user location) indicator when using MapKit.

1) Blue dot is not placed in the correct location. It's not just slightly off, but in a different state. How do I get it to display in my current location? In a different app, I've seen the dot much closer to my current location but off by couple miles.

2) When I launch my app in the simulator, the blue dot (user location) indicator on the map view moves! This is best seen when the map is zoomed in. When the display is at street level, you can see the blue dot zipping across the map. Why is this happening? How can I get the dot to stay in one place?

3) I had previously seen that you can change your default location in Xcode. I don't remember how this is done. Can someone please advise where this is done?

Here's the header file:

#import <UIKit/UIKit.h>
#import <MapKit/MapKit.h>

@interface ViewController : UIViewController 
@property (weak, nonatomic) IBOutlet MKMapView *mapView;

@end

Here's the implementation file:

- (void)viewDidLoad
{
   [super viewDidLoad];
   [self.mapView setShowsUserLocation:YES];
}

It doesn't get any simpler than that, and yet I'm having strange problems. Here's my configuration:

  • Xcode 4.2.1
  • iOS 5
  • Mac 10.7 Lion

Thanks.

在模拟器中,当前位置默认情况下将设置为无。如果要专注于一个位置,请转到方案->编辑方案->选项->设置位置

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM