Group Group Group Group Group Group Group Group Group

Center Popover Viewcontroller

#1

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

#2

@jport1130 Do you still have issues with this?

#3

Yes sir I do. Thanks.

#4

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,