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
Post a Comment