ios - How to place variables inside button target selector -


i have button add target to, selector contain variable.
can add variable selector without receiving error?
thank in advance.

//this cause selector error when run self.save.addtarget(self, action: #selector(self.saveitems(datatosave)), forcontrolevents: .touchupinside) 

create additional function use action selector argument

func helperfunc() {     self.saveitems(datatosave) } 

and add it

self.save.addtarget(self, action: #selector(self.helperfunc), forcontrolevents: .touchupinside) 

Comments

Popular posts from this blog

mysql - Dreamhost PyCharm Django Python 3 Launching a Site -

java - Sending SMS with SMSLib and Web Services -

java - How to resolve The method toString() in the type Object is not applicable for the arguments (InputStream) -