Reputation: 35
I am a very new iOS dev and need your help.
I have a simple app, made from:
1 view controller that contains
Here is an image of my storyboard so it will be easier to understant:
=> I need 10 rep to post the image as an image
What I want is that when I click the play button on the cell inside "View Controller Search" it calls a method or function from the parent (main?) view controller including the url of the file to play.
I have already a working action on the play button, I have found how to get the url from it and printed it using NSLog so everything is fine from this part. My only problem is to find a way to communicate with the main view by sending the url.
If hope I am clear enough, thank you for your time.
Upvotes: 1
Views: 533
Reputation: 119242
You've got two options:
parentViewController
property of your contained controller, cast it to the type of the parent view controller and call a method on it. prepareForSegue:
of the parent view controller, set the parent as the search controller's delegate. prepareForSegue:
will be called three times when your parent view controller is loaded, once for each embed segue that you have defined in the storyboard above. Just like when you push on a navigation controller, this is your opportunity to configure the destination view controller. You can give each embed segue in your storyboard an identifier to help with this process.
Upvotes: 1