I'm implementing a custom PopoverBackgroundView, and as specified at Swift documentation I gotta implement the methods as follow:
class SettingsPopoverBackgroundView: UIPopoverBackgroundView {
override var arrowOffset: CGFloat {
get {
return 0.0
}
set {
super.arrowOffset = newValue
}
}
override var arrowDirection: UIPopoverArrowDirection {
get {
return UIPopoverArrowDirection.Up
}
set {
super.arrowDirection = newValue
}
}
func contentViewInsets() -> UIEdgeInsets {
return UIEdgeInsetsMake(10, 10, 10, 10)
}
func arrowBase() -> CGFloat {
return 2.0
}
func arrowHeight() -> CGFloat {
return 2.0
}
}
However, I'm still getting the error:
UIPopoverBackgroundView contentViewInsets must be implemented by subclassers.
It seems like Apple has some garbled exception as for this subclassing, as can be seen here, because I do implement contentViewInsets, but still get the error.
This is how I am settings the background class to the popover in the prepareForSegue method:
popover.popoverBackgroundViewClass = SettingsPopoverBackgroundView.self
Is it right?
Can anyone see what am I doing wrong?