how to override UIView.pointInside in swift? -
i'm trying port code obj-c swift, experienced lot of troubles.
one of issues overriding pointinside of uiview class:
class myview : uiview{ func pointinside(point: cgpoint, withevent event: uievent) -> bool { if point.x < 0 { return false } else { return true } }}
if don't add "override", error:
/xxx.swift:37:10: method 'pointinside(_:withevent:)' objective-c selector 'pointinside:withevent:' conflicts method 'pointinside(_:withevent:)' superclass 'uiview' same objective-c selector
if add "override", error:
/xxx.swift:37:19: method not override method superclass
according doc, there should pointinside function
the function in uikit declared as
func pointinside(_ point: cgpoint, withevent event: uievent?) -> bool
the optionality (namely uievent?
) needs match.
this error message seems less useful; might want file bug.
Comments
Post a Comment