I got a problem with a universal app that were initial design for the iPhone and I used a 3rd party class for a popup on the iPhone. on the iPad I want to use the Apple provided popup. My problem is my code is written so that the View Controller for the popup already is initialized in the viewDidLoad
of the class containing the popup, and when seguing - a new instance of that class is allocated. Is there a way to pass it the bckMusicPlayer
that´s already been allocated in prepareForSegue
?
@property (nonatomic,strong) MJDetailViewController *bckMusicPlayer; //Already initialized when prepareForSegue get´s called. I want to segue to this object.
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
NSLog(@"prepare for segue");
if ([segue.identifier isEqualToString:@"Show iPad Player"]) {
if ([segue isKindOfClass:[MJDetailViewController class]]) {
}
}
}
edit: I got it working passing it the player (AVAudioPlayer) object from bckMusicPlayer
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
if ([segue.identifier isEqualToString:@"Show iPad Player"]) {
NSLog(@"class: %@",[segue class]);
if ([segue.destinationViewController isKindOfClass:[MJDetailViewController class]]) {
NSLog(@"prepare for segue");
MJDetailViewController *destinationVC = segue.destinationViewController;
destinationVC.player = self.bckMusicPlayer.player;
}
}
}