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