Reload and display a tableView whitch is based on a view in the MainStoryboard

249 views Asked by At

I'm searching for a solution for the upper since last week, but I found no solution on the internet. So I thought I'll get help here.

Now to may question: I have a MainStoryboard and in it a ViewController with a View. On that view I've put a tableView. ViewController.h

IBOutlet UITableView *tableView
//on bottom
@property (nonatomic, retain) UITableView *tableView;

ViewController.m I've synthesized it and now I would like to reload and display it while the view is shown. The following things I tested with no result: [tableView reloadData]; [self.tableView reloadData]; [self.tableView setNeedsDisplay]; And if I used [self.view setNeedsDisplay]; I've got the following Error:

Terminating app due to uncaught exception 'NSInternatlInconsistencyExeption', reason: 'Could not load NIB in bundle: 'NSBundle <...> (loaded)' with name 'ViewController'' * First thow call stack: (...) terminate called throwing an exception(lldb)

Thats right, there is no NIB file, because I've used the Storyboard. Well have anyone an idea?

Only thing I've found is, that if I reload the view by a button on the view within the Storyboard, the tableView gets reloaded - complete reload - but that is no solution.

Can I do something for that in -(void)prepareForSegue:(UIStoryboard *)segue sender:(id)sender? That method I'm using only for an popover till now.

1

There are 1 answers

4
Amy Worrall On

Have you actually connected the IBOutlet up in Interface Builder?

Xcode should tell you if it's connected: it'll show a little circle in the margin of your header file, and if that circle has a dot inside it it's connected, if not then it isn't.

Dots

To connect an outlet in Interface Builder, right-drag from the thing with the outlet (i.e. your view controller) to the thing you want to connect it to (your table), and when you let go it gives you a menu of possible outlets to choose from.