I'm trying to create a simple popover somewhere on the screen, but for some reason it just keeps crashing. It doesn't give me any erro (Zombie Objects are enabled)
UIViewController *viewController = [[UIViewController alloc] init];
UIView *view = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 200, 200)];
view.backgroundColor = [UIColor redColor];
viewController.view = view;
UIPopoverController *popover = [[UIPopoverController alloc] initWithContentViewController:viewController];
[popover presentPopoverFromRect:CGRectMake(0, 0, 100, 100) inView:self.view.superview permittedArrowDirections:UIPopoverArrowDirectionDown animated:YES];
I'm just trying to create a popover at a random position, is this not possible?
EDIT: Also tried it like this
@property (nonatomic, retain) UIPopoverController *popover;
@synthesize popover = _popover;
UIViewController *viewController = [[UIViewController alloc] init];
viewController.view.backgroundColor = [UIColor redColor];
_popover = [[UIPopoverController alloc] initWithContentViewController:viewController];
_popover.delegate = self;
[_popover presentPopoverFromRect:CGRectMake(0, 0, 200, 200) inView:self.view permittedArrowDirections:UIPopoverArrowDirectionDown animated:YES];
EDIT2: It might be relevant and I forgot to mention is, but this code is being called in another view.
This works fine!
UIViewController *viewController = [[UIViewController alloc] init];
viewController.contentSizeForViewInPopover = CGSizeMake(200, 200);
viewController.view.backgroundColor = [UIColor redColor];
UIPopoverController *popver1 = [[UIPopoverController alloc] initWithContentViewController:viewController];
[popver1 presentPopoverFromRect:CGRectMake(250, 200, 200, 200) inView:self.view permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES];
DocumentViewController *document = [[DocumentViewController alloc] initWithIssue:_readerModel.currentIssue];
[self.navigationController pushViewController:document animated:YES];
When I call the same EXACT code inside DocumentViewController it doesn't work.