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

Popular posts from this blog

twig - Using Twigbridge in a Laravel 5.1 Package -

jdbc - Not able to establish database connection in eclipse -

firemonkey - How do I make a beep sound in Android using Delphi and the API? -