警告:'MKMapView'可能无法响应'-addCircleWithRadius:'

时间:2011-10-18 14:39:52

标签: iphone ios memory-leaks warnings

我测试了应用程序的第一个两三个rimes,在我使用创建的UISlider来改变一个圆的直径(叠加)之后它崩溃了几次,然后它崩溃了。现在,当我点击/点击时滑块改变了值,它突然崩溃。结果我有一个警告'MKMapView'可能没有响应'-addCircleWithRadius:'。我做错了什么?我也发布了代码。

- (void)handleLongPress:(UIGestureRecognizer *)gestureRecognizer
{
if (gestureRecognizer.state != UIGestureRecognizerStateBegan)
    return;

CGPoint touchPoint = [gestureRecognizer locationInView:mapview];    
CLLocationCoordinate2D touchMapCoordinate = [mapview convertPoint:touchPoint toCoordinateFromView:mapview];

//add pin where user touched down...
MKPointAnnotation *pa = [[MKPointAnnotation alloc] init];
pa.coordinate = touchMapCoordinate;
pa.title = @"Kerkim me baze rrethin";
[mapview addAnnotation:pa];
[pa release];
tmC = touchMapCoordinate;

double radius = 500.0;

MKCircle *circle = [MKCircle circleWithCenterCoordinate:tmC radius:radius];
[mapview addOverlay:circle];

}

- (void)addCircleWithRadius:(double)radius
{
MKCircle *circle = [MKCircle circleWithCenterCoordinate:tmC radius:radius];
[mapview addOverlay:circle];
[circle release];
}

- (IBAction)sliderChanged:(UISlider *)sender
{
[mapview removeOverlays:[mapview overlays]];    
double radius = (sender.value);
[mapview addCircleWithRadius:radius];//Here appears the warning,this is the order of my code.
}

1 个答案:

答案 0 :(得分:2)

MKMapView类没有addCircleWithRadius:方法 - 该方法是您编写的类的一部分,因此您可能应该调用[self addCircleWithRadius:radius]