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.


Popular posts from this blog

c# - ODP.NET Oracle.ManagedDataAccess causes ORA-12537 network session end of file -

matlab - Compression and Decompression of ECG Signal using HUFFMAN ALGORITHM -

utf 8 - split utf-8 string into bytes in python -