In my app delegate, I have this method that gets stubbed out automatically, to do something when a view controller gets selected.
If the type of the viewController is SavedViewController, then it's a UITableView subclass, and I would like to refresh the table. However, this code doesn't work:
- (void)tabBarController:(UITabBarController *)tabBarController didSelectViewController:(UIViewController *)viewController {
if([viewController isKindOfClass: [SavedViewController class]]) {
[viewController.tableView reloadData];
}
}
The error I get is "request for tableView is something not a structure or union. Within the SavedViewController class, I can do this just fine:
[self.tableView reloadData];
So, what am I doing wrong in my function?
Switch this line:
[viewController.tableView reloadData];
To this:
[[(SavedViewController *)viewController tableView] reloadData];
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With