【发布时间】:2010-07-21 08:44:57
【问题描述】:
我正在制作一个 iphone 应用程序,该应用程序应从数组中获取纬度和经度,并应使用自定义注释/图钉定位和显示地图。我已经使用了 mapkit,方法如下:
//MapViewController.h
#import <UIKit/UIKit.h>
#import <MapKit/MapKit.h>
@interface MapViewController : UIViewController <MKMapViewDelegate> {
IBOutlet MKMapView *mapView;
MKPlacemark *mPlacemark;
}
@property (nonatomic, retain) IBOutlet MKMapView *mapView;
@end
//MapViewController.m
#import "MapViewController.h"
#import <MapKit/MapKit.h>
@implementation MapViewController
@synthesize mapView;
// Implement viewDidLoad to do additional setup after loading the view, typically from a nib.
- (void)viewDidLoad {
[super viewDidLoad];
CLLocationCoordinate2D location = mapView.userLocation.coordinate;
MKCoordinateRegion region;
MKCoordinateSpan span;
location.latitude = 37.250556;
location.longitude = -96.358333;
span.latitudeDelta = 0.05;
span.longitudeDelta = 0.05;
region.span = span;
region.center = location;
[mapView setRegion:region animated:YES];
[mapView regionThatFits:region];
}
- (void)viewDidUnload {
// Release any retained subviews of the main view.
// e.g. self.myOutlet = nil;
[mapView setNeedsDisplay];
}
@end
这不会定位纬度和经度的地方。请帮忙。
【问题讨论】:
-
请在下次发布之前格式化您的代码(选择它并单击工具栏上的“010101”按钮。并且不要包含显然不必要的代码部分 - 其他人会更容易帮助您.
-
下次一定会做...
标签: iphone maps mapkit mkmapview android-mapview