Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/multithreading/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios 等待方法成功运行_Ios_Multithreading_Mapkit - Fatal编程技术网

Ios 等待方法成功运行

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

我希望确保[mapView addAnnotation:annotation1]已经运行,并调用他的所有代理,然后运行其余代码

 -(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,你能回答我的密码吗?回答什么问题?如果你希望得到任何帮助,你需要澄清这个问题。