我试图把facebook的AsyncDisplayKit和DMLazyScrollView结合起来。当移动到下一个/上一个图像时,查看如下所示的闪烁:

如果没有AsyncDisplayKit,这个问题就不会发生。
下面是代码中负责获取图像的部分:
- (UIViewController *) controllerAtIndex:(NSInteger) index {
if (index > viewControllerArray.count || index < 0) return nil;
id res = [viewControllerArray objectAtIndex:index];
if (res == [NSNull null]) {
UIViewController *contr = [[UIViewController alloc] init];
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
ASNetworkImageNode *_mediaNode = [[ASNetworkImageNode alloc] init];
_mediaNode.backgroundColor = ASDisplayNodeDefaultPlaceholderColor();
_mediaNode.URL = [NSURL URLWithString:[imagesUrl objectAtIndex:index]];
_mediaNode.frame = contr.view.bounds;
dispatch_async(dispatch_get_main_queue(), ^{
[contr.view addSubview:_mediaNode.view];
});
});
[viewControllerArray replaceObjectAtIndex:index withObject:contr];
return contr;
}
return res;
}很高兴知道是否有人解决了这个问题。
发布于 2016-05-08 21:04:14
我们来吧,这是它闪现的原因:
在将应用程序转换为使用AsyncDisplayKit时,一个常见的错误是将节点直接添加到现有的视图层次结构中。这样做实际上可以保证您的节点在呈现时闪现。
异步显示工具包文档
https://stackoverflow.com/questions/35604682
复制相似问题