wangmchn / WMPageController

An easy solution to page controllers like NetEase News
MIT License
2.92k stars 627 forks source link

你的这个reloadData感觉太暴力了,每次reloadData的时候都要把displayVC全去掉。 #180

Open githubzxq opened 7 years ago

githubzxq commented 7 years ago
for (UIViewController *vc in displayingViewControllers) {
    [vc.view removeFromSuperview];
    [vc willMoveToParentViewController:nil];
    [vc removeFromParentViewController];
}
if (self.scrollView) {
    [self.scrollView removeFromSuperview];
}
[self.frames removeAllObjects];
[self.progressView removeFromSuperview];
[self.scrollView.subviews enumerateObjectsUsingBlock:^(__kindof UIView * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
    [obj removeFromSuperview];
}];
Huang-Libo commented 7 years ago

@githubzxq 来个pull request?

githubzxq commented 7 years ago

恩。还有一种bug,就是程序刚进来的时候,当前当前为itemVC0 ,我然后快速滑动(不是点击,在滑动的时候VC0的requestBlock可能回来了reloadData)到itemVC1,此时menuView的item不能点击,也不能滑动,但是VC左右可以滑动。

githubzxq commented 7 years ago

老会遇到menuView不可以点击,不可以滑动。但是VC可以滑动的情况。与我频繁reloadData有关系?

githubzxq commented 7 years ago

这个reloadData哪些参数需要重新设,viewFrame需要重设一下吗?

githubzxq commented 7 years ago

我这边几乎是必现啊。

wangmchn commented 7 years ago

@githubzxq 你说的第二个bug我修复了下,在公司暂时不方便传到pods上去,等回去上传后你看看是否还存在。 关于reloadData的问题,不太清楚为何你的VC0的requestBlock回来需要做reloadData操作?

不过确实可以提供一个更轻量的刷新操作,例如当前只需交换或者刷新某几个位置的控制器的情况

githubzxq commented 7 years ago

因为我的app目前还没有编辑分组功能(增加,删除),只有网页客户端才可以编辑,所以我在每个分组VC下拉刷新请求会主动获取一下最新分组,这个时候就要reloadData。哎。

githubzxq commented 7 years ago

实际上提的一些bug都是我们使用wmpageController的方法和调用的方法不对,没理解透。

wuchunpeng commented 6 years ago

怎么才能在刷新时不删除之前的controller