Center Popover Viewcontroller

Does anyone have any recommendations on how to center a popover view controller on the screen? Thank you.

@jport1130 Do you still have issues with this?

Yes sir I do. Thanks.

hi @jport1130,
The apple documentation states that you need to provide a source rect for the popover, now that you don’t have any sample code here, you can

  1. Instantiate your popupViewController
  2. set the sourceView to self.view (i.e. the view from where you are calling this)
  3. set the source rect to CGRect(x: view.center.x, u: view.center.y, width: 0, height: 0)

cheers,

This topic was automatically closed after 166 days. New replies are no longer allowed.