ios - Responder Chain in Swift (nil target in UIButton target) -
i have got problem using responder chain in swift.
when setup buttons target using nil target like:
somebutton.addtarget(nil, action:"addbuttontapped:", forcontrolevents: .touchupinside)
the action send responder chain until action handled in controller. far :-)
but want intercept action, execute code , relay on controller. cannot find way in swift. in objc task easy guess there should way in swift too.
thanks in advance :-)
one of co-workers gave me hint recreate selector , send manually again.
let selector = selector("somebuttontapped:") let target: anyobject? = self.nextresponder()?.targetforaction(selector, withsender: button) uiapplication.sharedapplication().sendaction(selector, to: target, from: self, forevent: nil)
this recreates responder chain , relays new message next responder.
i hope find useful.