简体   繁体   English

在UITableViewController中重建表单元格

[英]rebuild table cells in UITableViewController

I have a UITableViewController that when loaded gets data from a web-service and stores it locally in an NSMutableArray, once that is loaded I need to loop through that data to build my table cells. 我有一个UITableViewController,在加载时从Web服务获取数据并将其本地存储在NSMutableArray中,一旦加载,我就需要遍历该数据来构建我的表单元格。

I have all of the code for looping through my array working fine I just need to know how to fire my controller to rebuild the table so my it displays my data. 我有所有遍历数组的代码都可以正常工作,我只需要知道如何触发控制器来重建表,以便它显示我的数据即可。

[self.tableView reloadData];

After saving the datas in mutatable array after calling webservices, call tableview reloadData 调用Web服务后将数据保存在可变数组中后,调用tableview reloadData

[self.tableView reloadData];



- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {

return [datas count];
}

Make sure that you update the mutable array "datas" value after storing content in mutable array, such as datas will have the web service contents. 将内容存储在可变数组中后,请确保更新可变数组的“数据”值,例如数据将具有Web服务内容。

Here is sample program of parsing and displaying the parsed content in table, you can refer it how they are reloading their table after parsing 是解析并在表中显示已解析内容的示例程序,您可以参考解析程序如何在解析后重新加载其表

All the best. 祝一切顺利。

I ended up following the instructions here for creating a UITableViewDataSource class, works like a champ! 我最终按照这里的说明创建了一个UITableViewDataSource类,就像冠军一样!

UITableViewDataSource simplified UITableViewDataSource简化

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

相关问题 将表格单元格添加到 inhiret UITableViewController 的类中 - add table cells to class that inhiret UITableViewController 带有静态单元格的UITableViewController:contentSize为{0,0} - UITableViewController with static cells: contentSize is {0, 0} 带有工具栏的模态UITableViewController(静态单元格) - Modal UITableViewController (static cells) with toolbar UITableViewController中的其他接口元素,未取消选择单元格 - Other interface elements in a UITableViewController, cells not deselecting 自定义UITableViewController单元格不会自动分配 - Custom UITableViewController cells won't auto allign UITableViewController不会显示即时消息创建的单元格 - UITableViewController wont display the cells im creating 使用静态单元格推送 UITableViewController 时出现断断续续的动画 - Choppy animation while pushing UITableViewController with static cells 嵌套的UITableViewController不显示任何单元格 - Nested UITableViewController does not show any cells iOS 5:使用静态单元格和文本字段在UITableViewController中隐藏键盘 - iOS 5: Hide keyboard in UITableViewController with static cells and textfields iOS - 在带有静态单元格的UITableViewController上使用UISearchDisplayController - iOS - Using a UISearchDisplayController on a UITableViewController with static cells
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM