0
的冷杉,二,三RIMES我所測試的應用程序,它崩潰了幾次之後,我用了UISlider創建改變circle's直徑(疊加),然後crashed.Now,只是當我點擊/輕按滑塊以更改值,它突然crashes.As結果我有一個警告「的MKMapView」可不迴應「-addCircleWithRadius:」我在做什麼錯。 ?我也發佈了代碼。警告:「的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.
}
是的,並從該方法中移除'[circle release];',因爲'circle'將被自動釋放。 – Anna
謝謝!現在的問題是resolved.I確實也刪除'[圈釋放]'可是,我可能會問,因爲與此有關的代碼另一個問題它發生在類似的問題[MKOverlay不調整順利(HTTP://? stackoverflow.com/questions/4876035/mkoverlay-not-resizing-smoothly),覆蓋並不順利,在all.Sometimes調整,當滑塊處於較大值位置重疊甚至disappears.I必須將其放置在較低值和而不是在那個位置上,因爲它是可見的。它可能是什麼? – Hari