Comments (7)
你好,这个的确是bug额...
demo中“作品”类别使用的局部刷新,“喜欢列表”使用的是reloaddata,应该统一使用局部刷新。
修改如下:
[wself.data addObjectsFromArray:array];
[wself.tableView reloadData];
改为
[wself.tableView beginUpdates];
[wself.data addObjectsFromArray:array];
NSMutableArray<NSIndexPath *> *indexPaths = [NSMutableArray array];
for(NSInteger row = wself.data.count - array.count; row<wself.data.count; row++) {
NSIndexPath *indexPath = [NSIndexPath indexPathForRow:row inSection:0];
[indexPaths addObject:indexPath];
}
[wself.tableView insertRowsAtIndexPaths:indexPaths withRowAnimation:NO];
[wself.tableView endUpdates];
代码已上传,请查看。
from douyin-ios-objectc.
@sshiqiao 谢谢回复
我没看到你新上传的代码,把你说的局部刷新方法替换reloaddata,问题还是没有解决哦
貌似,局部刷新和直接reloaddata,都会释放当前cell,然后再重新加载cell,即使把动画改成NO也是一样的
所以这个问题我试过很多办法都没办法修复
复现步骤:
AwemeListController中,上滑加载更多视频的时候,只有请求,没有更新数据源,所以也不会刷新table,只要请求了接口刷新tableview,bug就会复现了,即使换成局部刷新也还是不行,你可以试试哈
直接替换掉AwemeListController中下面的方法,然后上滑就会出现我说的问题了
=============bug复现代码===============
#pragma load data
-
(void)loadData:(NSInteger)pageIndex pageSize:(NSInteger)pageSize {
// 2秒模拟网络延迟
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(2 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
NSArray *array = [NSArray arrayWithArray:self.data];[self.tableView beginUpdates]; [self.data addObjectsFromArray:array]; NSMutableArray<NSIndexPath *> *indexPaths = [NSMutableArray array]; for(NSInteger row = self.data.count - array.count; row<self.data.count; row++) { NSIndexPath *indexPath = [NSIndexPath indexPathForRow:row inSection:0]; [indexPaths addObject:indexPath]; } [self.tableView insertRowsAtIndexPaths:indexPaths withRowAnimation:NO]; [self.tableView endUpdates]; [self.loadMore endLoading];
});
}
=============bug复现代码===============
from douyin-ios-objectc.
不会的,你再试试看,代码上传了。
from douyin-ios-objectc.
换成局部刷新还是不行的哦
`
-
(void)loadData:(NSInteger)pageIndex pageSize:(NSInteger)pageSize {
// 2秒模拟网络延迟
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(2 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
NSArray *array = [NSArray arrayWithArray:self.data];[self.tableView beginUpdates]; [self.data addObjectsFromArray:array]; NSMutableArray<NSIndexPath *> *indexPaths = [NSMutableArray array]; for(NSInteger row = self.data.count - array.count; row<self.data.count; row++) { NSIndexPath *indexPath = [NSIndexPath indexPathForRow:row inSection:0]; [indexPaths addObject:indexPath]; } [self.tableView insertRowsAtIndexPaths:indexPaths withRowAnimation:NO]; [self.tableView endUpdates]; [self.loadMore endLoading];
});
}
`
你把这段代码替换上去,就能看到bug了
from douyin-ios-objectc.
@sshiqiao 此外还想提一点建议哈
因为我看到你是用AVPlayerManager单例管理所有的player的播放,暂停,重放等
如果有添加了滑动功能,越到后面滑的越多,单例里面的player就会越来越多,每次播放器播放,暂停什么的,都会遍历所有player,对性能有不必要的开销
如果能在适当的时机,删除playerarray里面的播放器那就很好了
from douyin-ios-objectc.
如何实现下拉加载功能。。大佬
from douyin-ios-objectc.
如何实现下拉加载功能。。大佬
加个MJRefresh不就可以了
from douyin-ios-objectc.
Related Issues (20)
- 画面闪烁问题
- 内存是不是泄漏啊?超级影响使用的老兄! HOT 1
- 后期有没有可能用AsyncDisplayKit替换UITableView
- 有关格式工厂转格过的mp4视频播放问题
- Xcode11运行播放视频黑屏是怎么回事? HOT 3
- 有预加载功能
- 没有实现边下边播的功能,而且是视频下载完之后才会播放,不能实时播放 HOT 2
- 进度条问题
- App called -statusBar or -statusBarWindow on UIApplication: this code must be changed as there's no longer a status bar or status bar window. Use the statusBarManager object on the window scene instead HOT 2
- 我有python抖音数据爬虫源码
- 受益很大,感谢作者!不过每个cell里都有一个AVPlayerView,这样可能会导致内存暴增,尤其是频繁切换视频的时候... HOT 4
- 谁在来一个Android版抖音 齐活儿
- 运行直接崩溃 HOT 3
- 大神帮忙看下 消失的动画失效是什么原因
- [[AVPlayerManager shareManager] play:_player];
- 用谷歌浏览器,说明文档打不开
- 我们做了一个 golang 的后端服务 HOT 4
- UserInfoHeader 个人页头部能自适应高度么?
- 后台下载报加载失败,状态码-1002,解决方法
- 网络请求非常慢,要等1分钟左右才会有结果,测试的接口似乎有问题 HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from douyin-ios-objectc.