Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

指定行刷新 #3

Open
YMH123 opened this issue Dec 30, 2020 · 5 comments
Open

指定行刷新 #3

YMH123 opened this issue Dec 30, 2020 · 5 comments

Comments

@YMH123
Copy link

YMH123 commented Dec 30, 2020

No description provided.

@YMH123
Copy link
Author

YMH123 commented Dec 30, 2020

你好作者,我想实现reloadRowsAtIndexPaths,指定某一个indexpath刷新,需要怎么做

@SmileZXLee
Copy link
Owner

ZXTableView继承于UITableView,因此可以使用UITableView的所有属性和方法,通过以下代码即可实现:

[self.tableView reloadRowsAtIndexPaths:@[] withRowAnimation:UITableViewRowAnimationNone];

@YMH123
Copy link
Author

YMH123 commented Jan 4, 2021

谢谢回复
网络请求完数据,赋值给zxData
ws.tableView.zxDatas = @[@[model],@[ws.dataDetailModel],@[ws.dataDetailModel]].mutableCopy;
默认刷新的是整个列表,但是我只想刷新其中的某一行

@SmileZXLee
Copy link
Owner

网络请求完数据,此时tableView数据是空的,此时一般是要reload整个列表来渲染这些数据,因此ZXTableView在zxDatas的setter方法中自动调用了tableView的reloadData方法。
如果您是reload以后,已经显示了数据,需要再次刷新某一行,可以使用以下方式:

//通过insert...replace...等NSMutableArray的对象方法调用来修改zxDatas,此时不会触发reloadData。
[ws.tableView.zxDatas replaceObjectAtIndex:0 withObject:nil];
//手动刷新想要刷新的行
[ws.tableView reloadRowsAtIndexPaths:@[] withRowAnimation:UITableViewRowAnimationNone];

@YMH123
Copy link
Author

YMH123 commented Jan 5, 2021 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants