Travis M.
Travis M.

Reputation: 11257

Storyboard Popover from Button Misaligned

Using Xcode 7, my storyboard segues to popover are mis-aligned.

For example, if I simply drag a popover segue from a button, the arrow aligns to the top left of the button, instead of the center.

enter image description here

However, if I set the button directly, it's way off:

if segue.identifier == "seguePopoverSort" {
    let pop = segue.destinationViewController.popoverPresentationController!
    pop.sourceRect = btnSort.frame
    return
}

enter image description here

It's an iPad app in landscape, but the same issue happens in portrait. I have auto-layout turned on.

Anyone have any ideas?

Upvotes: 1

Views: 129

Answers (1)

William T.
William T.

Reputation: 14321

The only thing that I can think of is that you are only setting your sourceRect. You need to also set your "sourceView". This must be the view that contains your source rect.

If you set that, I believe it will solve your problem.

Upvotes: 1

Related Questions