Reputation: 2520
I want to start a new viewController without using a button and without using navigationController. I try this in code in my Class1:
- (void)audioPlayerDidFinishPlaying:(AVAudioPlayer *)player successfully:(BOOL)flag
{
NSLog(@"audioPlayerDidFinishPlaying");
Tag1U2ViewController* controller = [[Tag1U2ViewController alloc] init];
[self.navigationController pushViewController:controller animated:YES];
}
After the audio has finished it should call my Class2, that has only the following code:
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view.
NSLog(@"View loaded");
}
My console-output:
Jul 29 15:00:37 bastis-air HelloUniverse[541] <Warning>: audioPlayerDidFinishPlaying
Jul 29 15:00:37 bastis-air HelloUniverse[541] <Warning>: View loaded
My problem now is, that the new screen is completely black. I've only change the class of the new ViewController in the storyboard.
What I am doing wrong?
Upvotes: 1
Views: 2128
Reputation: 939
This is an old question but just in case it helps else my problem was that the xib file somehow got removed from the target project so it's worth double checking on that through Target Membership. It's possible a bad merge could've caused it.
Upvotes: 0
Reputation: 2520
Now I having set a storyboardId with the name "uebung2" now it works fine: My new code:
Tag1U2ViewController *ivc = [self.storyboard instantiateViewControllerWithIdentifier:@"uebung2"];
[self.navigationController pushViewController:ivc animated:YES];
Upvotes: 3