Reputation: 1
In my app delegate I have a navigationController
property.
In my first view I have some buttons and tapping them will make another view appear when it is pushed on navController
.
In this new view there is another button to open a UITableViewController
by pushing it on the navController
.
The problem is in the last view, UITableViewController
, in fact in viewDidLoad
, if I have no data, I try to pop it off the navigationController
but my app crashes.
However, if I connect the pop to a button it works great.
I reference my app delegate instance in order to popViewControllerAnimated:
, so what is the problem?
Upvotes: 0
Views: 313
Reputation: 12106
I'm not sure what's wrong with the code, can you post your viewDidLoad method?
Also, is it possible to check whether your table will have data BEFORE you push the tableView onto the nav stack? That would be a much cleaner UI, rather than showing and then immediately popping a view. If there is no data, disable the button that launches the table view.
Upvotes: 1