waynezxcv / Gallop

A framework for build smooth asynchronous iOS APP.
MIT License
746 stars 161 forks source link

确实很流畅啊,评论功能怎么加啊 #7

Closed ganjmeng closed 8 years ago

ganjmeng commented 8 years ago

确实很流畅啊,评论功能怎么加啊? 还有个问题 ,为什么微信点赞的时候对应的cell不会闪一下?

ganjmeng commented 8 years ago

还有 对于长文章的收起和展开也可以加进来哦

waynezxcv commented 8 years ago

由于是异步绘制,而且为了减少View的层级,整个显示内容都是在同一个View上面,所以会在刷新的时候闪一下,在点赞或者评论后,需要刷新时可以先把原先Cell的内容截图覆盖在Cell上, 延迟0.25s后待刷新完成后,再将这个截图从Cell上移除 例如这样: UIImage* screenshot = [GallopUtils screenshotFromView:cell]; UIImageView* imgView = [[UIImageView alloc] initWithFrame:[self.tableView convertRect:cell.frame toView:self.tableView]]; imgView.image = screenshot; [self.tableView addSubview:imgView]; dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.25f * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ [imgView removeFromSuperview]; }); 或者把需要刷新的部分创建在另一个View上。 已经更新了demo