开发者

How do you use reloadData?

I have a table view set up in IB. It's delegate/datasource are connected to this class:

@interface EditPlayersViewController : UIViewController <UITableViewDelegate, UITableViewDataSource> {
开发者_运维问答

I'm trying to call the reloadData method. If I use [self.view reloadData]; it doesn't respond, I guess because technically self.view isn't a UITableView. I tried to add the following:

IBOutlet UITableView *myTableView

and then I connected it to my table view in IB. Now my program crashes when the view loads. Any ideas?


Make EditPlayersViewController a subclass of UITableViewController rather than UIViewController. Dump the explicit interface implementations and the IBOutlet. Then, [self.tableView reloadData] should work.


Watch the console when it crashes and then bring up the debugger window. Both of these windows will give you great insight into what is happening. The data you're trying to load may be to culprit and not the reloadData call.


Make sure you have implemented the UITableView data source methods. put break points in data source methods and try to find out where it is crashing.

UITableViewDataSource_Protocol/Reference

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜