Hi!
I got confused while I am trying to achieve showing a xib or storyboard view inside of a xib view.
I have a table filled with ViewCell xibs and every one of them has buttons for playing podcasts.
When the user clicks the "play button", I want to show a full-screen player view top of the screen, like an alert notification with a close button, play button, volume slider, etc.
If I create and show the player view inside of the cell xib, it only shows up to the size of a cell. I want to show the player view full-screen.
Thus, I created another xib file and put the play button, volume slider, etc. in that file.
But I can't call or show the player view xib from the table cell xib.
How can I achieve this? How do I reach another xib file inside of a xib file?
I tried this :
But couldn't get any value from this for now.
Also, do you suggest using a storyboard view for showing it in xib? If so, I could use storyboard view too but I still need help calling it.
I got confused while I am trying to achieve showing a xib or storyboard view inside of a xib view.
I have a table filled with ViewCell xibs and every one of them has buttons for playing podcasts.
When the user clicks the "play button", I want to show a full-screen player view top of the screen, like an alert notification with a close button, play button, volume slider, etc.
If I create and show the player view inside of the cell xib, it only shows up to the size of a cell. I want to show the player view full-screen.
Thus, I created another xib file and put the play button, volume slider, etc. in that file.
But I can't call or show the player view xib from the table cell xib.
How can I achieve this? How do I reach another xib file inside of a xib file?
I tried this :
Code Block swift let podcastViewCell = (UINib(nibName: "PodcastViewCell", bundle: nil), forCellWithReuseIdentifier: "PodcastViewCell")
But couldn't get any value from this for now.
Also, do you suggest using a storyboard view for showing it in xib? If so, I could use storyboard view too but I still need help calling it.
I have found the answer by using delegates. Now I can hide/unhide (edit, overall) the view's properties. This was the problem answered by Sh_Khan:
and its protocol for passing data :
In the View Controller, I want to edit element from, added this :
Now my player works as expected and I can hide/unhide my UIView!
Thank you for all of your efforts again! Hope to see you in another thread 😅
I have declared a delegate in PodcastViewCell:Problem is here
Code Block DetailViewController().setupPodcastPlayer(link: url)
This DetailViewController() is a new instance not the presented one , hook the real shown one and change it's attribute as needed through delegate or a notification if you need to
Code Block swift var delegate: PodcastViewCellDelegate?
and its protocol for passing data :
Code Block swift protocol PodcastViewCellDelegate { func podcastButtonClicked(podcastUrl: String) }
In the View Controller, I want to edit element from, added this :
Code Block swift extension DetailViewController: PodcastViewCellDelegate { func podcastButtonClicked(podcastUrl: String) { setupPodcastPlayer(link: podcastUrl) podcastPlayerView.isHidden = false } }
Now my player works as expected and I can hide/unhide my UIView!
Thank you for all of your efforts again! Hope to see you in another thread 😅