Ios 等待方法成功运行
我希望确保[mapView addAnnotation:annotation1]已经运行,并调用他的所有代理,然后运行其余代码Ios 等待方法成功运行,ios,multithreading,mapkit,Ios,Multithreading,Mapkit,我希望确保[mapView addAnnotation:annotation1]已经运行,并调用他的所有代理,然后运行其余代码 -(void) addAnnotations:(double)latit :(double)longit :(NSString*)value{ Annotation *annotation1=[[Annotation alloc]init]; annotation1.coordinate = CLLocationCoordinate2DMake(l
-(void) addAnnotations:(double)latit :(double)longit :(NSString*)value{
Annotation *annotation1=[[Annotation alloc]init];
annotation1.coordinate = CLLocationCoordinate2DMake(latit,longit);
annotation1.title=[NSString stringWithFormat:@"%@", secondIdArray];
[mapView addAnnotation:annotation1];
if([annotationArray count]==0)
{
annotationArray=[[NSMutableArray alloc]initWithObjects:annotation1,nil];
valueArray=[[NSMutableArray alloc]initWithObjects:secondIdArray,nil];
}
else{
[annotationArray addObject:annotation1];
[valueArray addObject:secondIdArray];
}
for(int i=0;i<[annotationArray count];i++)
{
Annotation *a = ((Annotation*)[annotationArray objectAtIndex:i]);
MKAnnotationView *av1=[mapView viewForAnnotation:((Annotation*)[annotationArray objectAtIndex:i])];
pinColor=[self colorForAcceleration2:[[valueArray objectAtIndex:i]intValue]];
a.title=[NSString stringWithFormat:@"Particule Level:%@",[valueArray objectAtIndex:i]];
a.color=pinColor;
av1.image=[ZSPinAnnotation pinAnnotationWithColor:a.color];
av1.annotation=a;
}
}
- (void)mapView:(MKMapView *)mapView didAddAnnotationViews:(NSArray *)views
{
//Here
[self.mapView selectAnnotation:[[self.mapView annotations]objectAtIndex:0] animated:YES];
}
如果它不是异步的,那么它将是异步的。你到底在问什么?@CrimsonChris,你能回答我的密码吗?回答什么问题?如果你希望得到任何帮助,你需要澄清这个问题。