원하는 글자를 화면에 입력하는 코드입니다.

import UIKit
class ViewController: UIViewController {
@IBOutlet weak var myText: UITextField!
var screen_text:String = " "
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view.
}
@IBAction func Click_A(_ sender: UIButton) {
screen_text = screen_text + "A"
myText.text = screen_text
}
@IBAction func Click_B(_ sender: UIButton) {
screen_text = screen_text + "B"
myText.text = screen_text
}
@IBAction func Click_clear(_ sender: UIButton) {
screen_text = ""
myText.text = ""
}
}'IOS programming' 카테고리의 다른 글
| [IOS programming] Simple calculator (0) | 2023.06.20 |
|---|