0

私はこのスクロールビューを持っており、URLからいくつかの画像を彼に読み込んでいます。問題は、すべてがロードされるまで、スクロールビューにそれらのいずれも表示されないことです。彼女の読み込みが完了した瞬間にすべての画像を表示したいと思います。

私のコードは次のようになります:

-(void)loadPhotosToLeftscroll{

    for (int count = 0 ; count < [leftPhotoArray count]; count++) {
        NSLog(@"nextPhotoHight: %f",nextLeftPhotoHight);

        NSMutableDictionary *photoDict;
        photoDict = [leftPhotoArray objectAtIndex:count];

        float photoHight = [[photoDict objectForKey:@"photos_height"]floatValue];
        float photoWide= [[photoDict objectForKey:@"photos_width"]floatValue];
        NSString *photoPath = [photoDict objectForKey:@"photos_path"];

        NSData * imageData = [[NSData alloc] initWithContentsOfURL: [NSURL URLWithString:photoPath]];

        UIImage *image = [[UIImage alloc] initWithData:imageData];

        UIImageView *photoView = [[UIImageView alloc]initWithFrame:CGRectMake(10 , nextLeftPhotoHight, photoWide, photoHight )];

        [photoView setImage:image]; 
        [photoView.layer setMasksToBounds:YES];
        [photoView.layer setCornerRadius:6];

        nextLeftPhotoHight = photoView.frame.size.height + photoView.frame.origin.y + 10;

        [leftBlockScroll addSubview:photoView];
    }

}
4

1 に答える 1