简体   繁体   English

UITableView reloadData之前的reloadSections

[英]UITableView reloadSections before reloadData

I have a standard UIViewController with a UITableView inside of it. 我有一个带有UITableView的标准UIViewController。 I am trying to reloadSections; 我正在尝试reloadSections; however, it is locking up my app. 但是,它锁定了我的应用程序。 I've noticed that the very first time that I load data in the table and I call reloadSections, it locks up; 我注意到,第一次将数据加载到表中并调用reloadSections时,它会锁定; however, if I call reloadData the FIRST time, and reloadSections after subsequent updates it works fine. 但是,如果我第一次调用reloadData,并在后续更新后调用reloadSections,则效果很好。

Is this the expected behavior? 这是预期的行为吗?

I do not quite understand what you mean,but you can try this. 我不太明白您的意思,但是您可以尝试一下。

[CATransaction begin];  
[CATransaction setCompletionBlock:^{  
     [yourTable reloadData];  
}];  
[yourTable reloadSections:[[NSIndexSet alloc] initWithIndex:2] withRowAnimation:UITableViewRowAnimationAutomatic];
[CATransaction commit];

Hope this helps you. 希望这对您有所帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM