【发布时间】:2010-05-18 05:45:03
【问题描述】:
我有两种观点。第一个是带有一些注释的MKMapView。单击UIButton 会在堆栈中推送第二个视图。这有一个UITableView,其中包含与地图注释相对应的注释列表。因此,当您单击删除按钮时,如何调用我在另一个视图中的MKMapView,以便我可以删除注释。我的 MKMapView 在我的应用程序委托以及我当前的类中声明。我正在尝试使用以下内容,但它不起作用:
RideAppDelegate *appDelegate = (RideAppDelegate *)[[UIApplication sharedApplication] delegate];
Annotation *ano;
CLLocationCoordinate2D anoPoint;
anoPoint.latitude = [[eventToDelete valueForKey:@"latitude"] doubleValue];
anoPoint.longitude = [[eventToDelete valueForKey:@"longitude"] doubleValue];
ano = [[[Annotation alloc] init] autorelease];
ano.coordinate = anoPoint;
[appDelegate.ridesMap removeAnnotation: ano];
[appDelegate release];
我一定是试图错误地访问我其他视图的MKMapView?
【问题讨论】:
标签: iphone delegates mkmapview uiapplicationdelegate