I have a UIAlertView which appears as a confirmation when a user wants to delete a RegionAnnotation.
I'm having trouble figuring out how to access the RegionAnnotationView that called the UIAlertView which I need in order to delete the RegionAnnotation.
Here's my broken code - you can see where I'm trying to cast the AlertView's superview into a RegionAnnotationView (an admittedly bad idea).
- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
{
if(buttonIndex==0)
{
NSLog(@"alertView.superview is a %@",alertView.superview);
RegionAnnotationView *regionView = (RegionAnnotationView *)alertView.superview;
RegionAnnotation *regionAnnotation = (RegionAnnotation *)regionView.annotation;
[self.locationManager stopMonitoringForRegion:regionAnnotation.region];
[regionView removeRadiusOverlay];
[self.mapView removeAnnotation:regionAnnotation];
}
}