Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/99.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 动画不';滚动UIScrollView时无法工作_Ios_Uiscrollview - Fatal编程技术网

Ios 动画不';滚动UIScrollView时无法工作

Ios 动画不';滚动UIScrollView时无法工作,ios,uiscrollview,Ios,Uiscrollview,我有一个UIScrollView,里面有一堆项目,类似于facebook提要。在这个提要中,我有一堆从互联网上加载的图像。加载图像时,图像淡入。问题是,如果我滚动滚动滚动视图,那么直到我的手指离开滚动视图,图像动画才会淡入。滚动时是否有任何方法更新UIScrollView视图的子视图 -(void)loadStuff:(DipticView*)diptic{ //DipticView is a UIView subclass that holds the imageview and so

我有一个UIScrollView,里面有一堆项目,类似于facebook提要。在这个提要中,我有一堆从互联网上加载的图像。加载图像时,图像淡入。问题是,如果我滚动滚动滚动视图,那么直到我的手指离开滚动视图,图像动画才会淡入。滚动时是否有任何方法更新UIScrollView视图的子视图

-(void)loadStuff:(DipticView*)diptic{
    //DipticView is a UIView subclass that holds the imageview and some other information
    ConnectionManager *conman = [[ConnectionManager alloc] init];
    WebImage *webimage = [diptic.item.images firstObject]; //webimage holds the imageurl and the image

    [conman getImageWithURL:webimage.image_URL inBackgroundWithBlock:^(NSString *error, id image) {
        webimage.image = image;
        diptic.imageView.image = image;
        diptic.imageView.alpha = 0;
        diptic.userInteractionEnabled = NO;
        [UIView animateWithDuration:.4 animations:^{
            diptic.imageView.alpha = 1;
        } completion:^(BOOL finished) {
            diptic.userInteractionEnabled = YES;
        }];
        //The diptics are all subviews of the scrollview.
    }];
}

但我不确定这种方法是否能很好地用于animateWithDuration。

图像中的淡入度如何?我只是调用UIView animateWithDuration,所以我认为它不仅仅是animateWithDuration。因为它看起来不像康曼完成块中的任何东西正在被执行。我尝试包装整个调用以在dispatch\u async中获取映像,但似乎没有解决问题。
   dispatch_async(dispatch_get_main_queue(), ^{
    [UIView animateWithDuration:.4 animations:^{
        diptic.imageView.alpha = 1;
    } completion:^(BOOL finished) {
        diptic.userInteractionEnabled = YES;
    }];
});