ios - Using UIButton Text as Text Input - Swift -
hello have profilelbl variable below uibutton. want text of button input in database (parse). couldn't figured out. tried lots of things still getting error:
@iboutlet weak var profilelbl: uibutton! var notification = pfobject(classname: "notifications") notification["actionreceivername"] = profilelbl.text /*not working*/ /* tried notification["actionreceivername"] = sender.profilelbl.text notification["actionreceivername"] = profilelbl.title */
you can easy that
if let button = profilelbl as? uibutton { if let title = button.titleforstate(.normal) { println(title) notification["actionreceivername"] = title } }
Comments
Post a Comment