ios - Storing input from field as variable with swift 3 -
i realize question has been asked numerous times before, can't quite solutions work, copying , pasting them, , suspect swift documentation spans 3 versions since swift's release.
i'm attempting simple storing variable field input , not having luck.
import uikit class viewcontroller: uiviewcontroller { @iboutlet var usernumber: uilabel! @iboutlet var userfield: uitextfield! @ibaction func userbutton(_ sender: uibutton) { let userinput = userfield.text //some action } override func viewdidload() { super.viewdidload() // additional setup after loading view, typically nib. } override func didreceivememorywarning() { super.didreceivememorywarning() // dispose of resources can recreated. }
}
you should check whether have set textfield's delegate respect parent view controller.
go storyboard. select textfield. right click on it. set delegate textfield view controller
Comments
Post a Comment