I'm new to xcode and am stuck on this problem, because after trying several sample code examples online, nothing works.
Could you help me figure out what the problem is?
My code below:
import UIKit
class ViewController: UIViewController {
@IBOutlet weak var Writingboard: UITextView!
@IBOutlet weak var Talkbutton: UIButton!
@IBAction func TalkbuttonTapped(_ sender: AnyObject){
Talkbutton.setTitle("Tap to Stop", for: .normal)
Writingboard.text="talking"
}
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
//Talkbutton.isEnabled=true
Writingboard.text="test the initializer"
}
}
you can try this bellow code you definetly get the output what you expected and make sure you connect the story board to your view controller class you button action and textfiled outlets can give IBActions and IBOutlets properly

output before not button tapped

After tapped the button

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With