0

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?

Cœur
  • 37,241
  • 25
  • 195
  • 267
ticofab
  • 7,551
  • 13
  • 49
  • 90

3 Answers3

1

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

Ryan Heitner
  • 13,119
  • 6
  • 77
  • 119
The iOSDev
  • 5,237
  • 7
  • 41
  • 78
1

If you don't have an IBOutlet of the UITableView you can follow this

UITableView *view = (UITableView*)[self.view];
[view  reloadData];
Siva
  • 59
  • 2
0

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];
ewiinnnnn
  • 995
  • 7
  • 7
  • hey ewiinnnnn, thanks for your prompt reply. I have built the thing using the Storyboard and I don't have any XIB file in my project. I have seen those mentioned in a lot of older tutorials. – ticofab Jun 24 '12 at 10:37