1
我对iOS开发完全陌生,正在为当地河流创建地图应用程序。应用程序的要点是允许用户通过选择不同的点来绘制河流上的路线。我正在使用MapKit来解决这个问题,但遇到了一些问题。我的主要问题是如何将一个按钮添加到注释中,以便一旦点击,一个细节窗口就会打开,用户可以了解更多关于该点的信息并将其添加到旅程中。这是我的代码,任何想法都会有帮助!iOS映射应用程序注释中的新视图
#import "ViewController.h"
#import "CoreLocation/CLLocation.h"
@interface ViewController()
@end
@implementation ViewController
- (void)viewDidLoad
{
[super viewDidLoad];
self.mapView.delegate = self;
}
- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
- (void)mapView:(MKMapView *)mapView didUpdateUserLocation:(MKUserLocation *)userLocation
{
// Add an annotation
MKPointAnnotation *point = [[MKPointAnnotation alloc] init];
point.coordinate = userLocation.coordinate;
point.title = @"Where am I?";
point.subtitle = @"I'm here!!!";
[self.mapView addAnnotation:point];
point.coordinate = CLLocationCoordinate2DMake(33.62258872997,-86.599988937378);
point.title = @"Civitan Park";
point.subtitle = @"Trussville, AL";
[self.mapView addAnnotation:point];
}
@end