Pavels
Pavels

Reputation: 1316

UISplitViewController reload data

How can I call function from UISplitViewController subclass to other ViewController.

I have an application that displays splitview and shows modal popup after. When popup is closed, I need to reload data. So appdelegate looks like this:

[self.window addSubview:splitview.view];
[splitview presentModalViewController:popup_ctrl animated:YES];

On TableViewController I've made funcion reloadData;

I found out that by subclassing UISplitViewController, I can detect closing of popup with -(void)viewDidAppear:(BOOL)animated. I've tried following code:

[[self.viewControllers objectAtIndex:0] reloadData];

However it crashes with NSInvalidArgumentException: unrecognized selector.

What do I have to modify to make the function reloadData work?

Upvotes: 1

Views: 1621

Answers (1)

Chris Allwein
Chris Allwein

Reputation: 2578

Why not explicitly add a property to your SplitViewController that references your TableViewController?

Then you can say

mySplitViewController.TableViewController = myTableViewController;

and later call

[mySplitViewController.TableViewController reloadData];

Upvotes: 1

Related Questions