UIPopoverPresentationController help please

I am updating one of our apps which previouly used "UIPopoverController" and I am tring to replace with "UIPopoverPresentationController". The problem is the popup view keeps appreaing if full screen no matter what I do. This is very frustrating. Please help.


Here is the code


MyViewController *controller2 = [[MyController alloc] initWithNibName:@"MyViewController" bundle:nil];

controller2.modalTransitionStyle = UIModalPresentationPopover;

controller2.preferredContentSize = CGSizeMake(611, 542);

controller2.view.clipsToBounds = YES;

controller2.view.layer.borderWidth = 5;

controller2.view.layer.borderColor = [UIColor purpleColor].CGColor;


UIPopoverPresentationController *popoverPresentation = controller2.popoverPresentationController;

[popoverPresentation setPermittedArrowDirections:UIPopoverArrowDirectionUp];

popoverPresentation.delegate = self;

[self presentViewController:controller2 animated:YES completion:nil];

Replies

I finally figured it out... I was using controller2.modalTransitionStyle = UIModalPresentationPopover; instead of controller2.modalPresentationStyle = UIModalPresentationPopover;


I posted this incase someone else has the same issue.