Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

UIPopOverController inside UISplitViewController

I have to show one popOver inside the left side of one splitController, I initialize the popOver whit an navigationController. But when i show the popOver my app crash.

Impostazioni *settings = [[Impostazioni alloc] initWithStyle:UITableViewStyleGrouped];
settings.title = NSLocalizedString(@"SETTINGS", nil);
settings.contentSizeForViewInPopover = kContentSizeOfPopOver;
UINavigationController *nav = [[UINavigationController alloc] initWithRootViewController:settings];
nav.navigationBar.tintColor = kTintColorNavigationBar;
nav.contentSizeForViewInPopover = kContentSizeOfPopOver;
UIPopoverController *popOver = [[UIPopoverController alloc] initWithContentViewController:nav];
[popOver presentPopoverFromBarButtonItem:self.navigationItem.rightBarButtonItem permittedArrowDirections:UIPopoverArrowDirectionDown animated:YES];

This is my code. Any ideas?

EDIT: Crash even if I set only a viewController instead of SplitController :/ And with a empty ViewController :/

like image 228
Nicolò Ciraci Avatar asked Nov 05 '22 09:11

Nicolò Ciraci


1 Answers

(Possibly duplicate of Error using UIPopoverController.)

In short, you need to retain the UIPopoverController somehow. Either by defining a property for it or by managing the ref count manually. With ARC, the latter is not an option, so you need to store the reference.

like image 194
Krumelur Avatar answered Dec 03 '22 06:12

Krumelur