Presenting a XIB View Freezes

46 views Asked by At

In storyboard I have a button on my Main Menu called showCountdownViewControllerPressed.

This button is supposed to show my XIB called TimerViewController.

But when I run the app, it freezes upon button press and then after a little while crashes the app.

I put this action in my CRViewController.m (my main menu) [I also have imported the TimerViewController.h in this file]

- (IBAction)showCountdownViewControllerPressed:(id)sender {
    NSLog(@"showTimerViewController");
    TimerViewController *timeController = [[TimerViewController alloc]
                                  initWithNibName:@"TimerViewController" bundle:nil];
    [self presentViewController:timeController animated:YES completion:nil];

CRViewController Countdown Clock Button XIB TimerViewController Memory TimerViewController Make-up Breakpoint Exceptions

2

There are 2 answers

0
gabbler On

Well, if it is LandScape only, you can add this in TimerViewController for iOS 8, which will make the TimerViewController rotate to the landscape mode.

- (BOOL)shouldAutorotate
{
    return YES;
}

- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation {
    return UIInterfaceOrientationLandscapeLeft;
}
8
diegomen On

That's not the answer to your problem but it can help. I'm putting it here because I can't add images on the comments. You can put an exception breakpoint at the bottom of the breakpoints tab, normally it will stop just before the crash and you will get more info about it.

enter image description here

Post where the exception breakpoint it's stopping for getting more help :)