I want to show a UIPopoverController
when clicking on a label. All elements are laid out with AutoLayout.
// In TorHeimPopoverViewController.swift
// self.view is TorHeimPopoverViewController's view
popover.presentPopoverFromRect(label.frame, inView: self.view, permittedArrowDirections: UIPopoverArrowDirection.Left, animated: true)
It's displayed in another UIPopoverController
(TorHeimPopoverViewController) and there in a Container
MainAppView -> TorHeimPopoverViewController -> ContainerView
How can I fix this?
The problem is, the inView
parameter is wrong for this purpose. The rect of label.frame
is in relation to the ContainerView
, in which it is.
For example, when label.frame
is x = 300, y = 100
, it will take these coordinates, but use self.view
as origin and not the container.