지도 뷰에서 특수 효과를 제거 할 수없는 이유는 무엇입니까?지도 뷰에서 특수 효과를 제거 할 수없는 이유는 무엇입니까?
내 코드 :
(공극) viewDidAppear : 애니메이션 (BOOL) { [슈퍼 viewDidAppear : 애니메이션]; [self becomeFirstResponder];
NSMutableArray * annotations = [[NSMutableArray alloc] init];
NSString * path = [[NSBundle mainBundle] pathForResource : @ "data"ofType : @ "plist"]; NSDictionary * dict = [NSDictionary dictionaryWithContentsOfFile : 경로];
if ([[NSUserDefaults standardUserDefaults] boolForKey : @ "blackKey"]) { NSLog (@ "Black is on"));
NSArray * ann = [dict objectForKey : @ "Category1"];
찾는 (; 나는 < [앤 카운트] I = 0 int로 난 ++) 다른 {NSString *coordinates = [[ann objectAtIndex:i] objectForKey:@"Coordinates"]; double realLatitude = [[[coordinates componentsSeparatedByString:@","] objectAtIndex:1] doubleValue]; double realLongitude = [[[coordinates componentsSeparatedByString:@","] objectAtIndex:0] doubleValue]; MyAnnotation *myAnnotation = [[MyAnnotation alloc] init]; CLLocationCoordinate2D theCoordinate; theCoordinate.latitude = realLatitude; theCoordinate.longitude = realLongitude; myAnnotation.coordinate=CLLocationCoordinate2DMake(realLatitude,realLongitude); myAnnotation.title = [[ann objectAtIndex:i] objectForKey:@"Name"]; myAnnotation.subtitle = [[ann objectAtIndex:i] objectForKey:@"Address"]; myAnnotation.icon = [[ann objectAtIndex:0] objectForKey:@"Icon"]; if ([[NSUserDefaults standardUserDefaults] boolForKey:@"blackKey"]) { NSLog(@"Black is on"); [mapView addAnnotation:myAnnotation]; [annotations addObject:myAnnotation]; } else { NSLog(@"Black is off"); [self.mapView removeAnnotation:myAnnotation]; } }
}
가 { // 아무것도를 수행하지 }
}
[self.mapView removeAnnotation:myAnnotation];
가 작동하지 않습니다.
감사합니다. A가 이미 removeAnnotationS를 사용하여 주석을 제거했습니다. –