开发者

UITableView reloaddata and tableHeaderView issue

I want to display something in the tableHeaderView and a blank table, then download something and reload the tableView and display something different in the tableHeaderView after that. Is there开发者_如何学JAVA somewhere I can put the code to change the tableHeaderView and these code will be called once the table is loaded each time? Thanks.


In the table Header you can take UILabel, UIView, UIImageView, UITextField, etc. anything you want. Then you just put it in the interface builer and bind it with the controller and whenever you need to update it you can just update without even reloading the tableView.

If you have the data inside the table then you have to do reloadData. But for the data in headerview, no need to do reloadData. Instead of that you can directly assign the value to your headerview as follows.

headerLaber.text=@"Header";
headerImageView.image = [UIImage imagenamed:@"image1.png"];

Let me know if you have any question.


in the interface builder, you can put a UILabel, or whatever view you want, inside the header of the UITabelView. Just drag the component you want to. I also advice you to create an IBOulet, so you can access it later. After you make something like this:

[youTableView reloadData];

Then you can update your header:

myHeaderLabel.text=@"New info i want to display".
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜