您好我的应用中存在问题。我必须在地图上标记(苹果)并在点之后显示到达它的路径。我导入了mapKit.framework。我试过这样做,但它不起作用。
代码:
@interface ViewController ()
@property (weak, nonatomic) IBOutlet UIBarButtonItem *Information;
//按钮信息=打开其他页面
@property (weak, nonatomic) IBOutlet UIBarButtonItem *map_path;
// button map_path =点之间的距离
@property (weak, nonatomic) IBOutlet UIBarButtonItem *map_location;
//按钮map_location =当前位置
@property (weak, nonatomic) IBOutlet MKMapView *mapView;
// mapview的声明
@end
@implementation ViewController
- (void)viewDidLoad
{
[super viewDidLoad];
if ([self respondsToSelector:@selector(edgesForExtendedLayout)])
self.edgesForExtendedLayout = UIRectEdgeNone;
}
- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
}
- (MKAnnotationView *)mapView:(MKMapView *)newMapView viewForAnnotation:(id )newAnnotation {
//replace the point with a picture
MKAnnotationView *a = [ [ MKAnnotationView alloc ] initWithAnnotation:newAnnotation reuseIdentifier:@"currentloc"];
if ( a == nil )
a = [ [ MKAnnotationView alloc ] initWithAnnotation:newAnnotation reuseIdentifier: @"currentloc" ];
a.image = [ UIImage imageNamed:@"815-car@2x.png" ];
a.canShowCallout = YES;
a.rightCalloutAccessoryView = [ UIButton buttonWithType:UIButtonTypeDetailDisclosure ];
UIImageView *imgView = [ [ UIImageView alloc ] initWithImage:[ UIImage imageNamed:@"815-car.png" ] ];
a.leftCalloutAccessoryView = imgView;
return a;
//via a button should calculate the distance from the point to the user
}
@end