Reputation: 7717
I'm moving my first stpes in iOS development. I have followed the first part of this tutorial to create a simple table. All fine, but now I would like to change the displayed data using the reloadData method of UITableView.
I keep seeing that if I my controller was a UITableViewController I could just do [self.tableView reloadData]
, but my controller is a UIViewController that embeds a UITableView.
How can I access the method from the code?
Upvotes: 0
Views: 2355
Reputation: 5267
If I understand what you want to do, then you have to make one IBOutlet for your UITableView and connect it with your UITableView and using that you can reload your table with the method you mentioned
Upvotes: 1
Reputation: 59
If you don't have an IBOutlet of the UITableView you can follow this
UITableView *view = (UITableView*)[self.view];
[view reloadData];
Upvotes: 1
Reputation: 995
are you using XIB ?
usually if your controller are UIViewController, then you will have something like
@property (nonatomic, retain) UITableViewController *myTableViewController;
or
@property (nonatomic, retain) IBOutlet UITableViewController *myTableViewController;
to reload just do
[self.myTableViewController reloadData];
Upvotes: 0