I am trying to use UIPopoverPresentationController to display a popover that doesn\'t take up the whole screen. I\'ve followed many different tutor
The accepted answer is correct. For completeness, see Adapting Presented View Controllers to a New Style in the Apple docs:
Use the delegate’s
adaptivePresentationStyleForPresentationController:method to specify a different presentation style than the default. When transitioning to a compact environment, the only supported styles are the two full-screen styles orUIModalPresentationNone. ReturningUIModalPresentationNonetells the presentation controller to ignore the compact environment and continue using the previous presentation style. In the case of a popover, ignoring the change gives you the same iPad-like popover behavior on all devices.
Make sure that the required configurations from Presenting a View Controller in a Popover are met:
After setting the modal presentation style [of the presented view controller] to
UIModalPresentationPopover, configure the following popover-related attributes:
- Set the
preferredContentSizeproperty of your view controller to the desired size.- Set the popover anchor point using the associated
UIPopoverPresentationControllerobject, which is accessible from the view controller’spopoverPresentationControllerproperty.- Set only one of the following:
- Set the
barButtonItemproperty to a bar button item.- Set the
sourceViewandsourceRectproperties to a specific region in one of your views.