Crash when I try to alloc a UIPopoverController
-
16-06-2021 - |
Frage
Hi I am at my wits end with what I am doing wrong here. Has anyone experienced anything similar? I checked the apple developer forums, google, stack overflow and couldn't find anything.
MyViewController *myView;
myView = [[MyViewController alloc] initWithNibName:@"MyViewController" bundle:nil];
//or myView = [[MyViewController alloc]init];
UIPopoverController *popover;
popover = [[UIPopoverController alloc] initWithContentViewController:myView]; //always crash at here
//i've tried with some others ViewController but it's still crash.
Thanks so much.
Lösung
Assuming you're developing for iPad, try to give the popOver
some frames, and try also to resize MyViewController
nib, otherwise when it tries to load the view, it can't 'cause it's too big!
Something like
CGSizeMake(MyViewController.view.frame.size.width, MyViewController.view.frame.size.height);
Remember to resize it though
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow