24.06.24 Today I Learned
2024. 6. 24. 20:47
import UIKit
class ViewController: UIViewController {
private var number: Int = 0
@IBOutlet weak var label: UILabel!
@IBOutlet weak var minusButton: UIButton!
@IBAction func minusButtonTapped(_ sender: Any) {
self.number -= 1
label.text = "\(self.number)"
}
@IBOutlet weak var plusButton: UIButton!
@IBAction func plusButtonTapped(_ sender: Any) {
self.number += 1
label.text = "\(self.number)"
}
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view.
}
}
calculator 앱 만들기
- 속성
- backgroundColor = .black
- textColor = .white
- 텍스트는 12345로 고정
- 텍스트 오른쪽 정렬
- Font = 시스템 볼드체, 사이즈 60
- AutoLayout
- leading, trailing = superView 로부터 30 떨어뜨리기
- top = superView 로부터 200 떨어뜨리기
- height = 100
- UIButton 속성
- font = .boldSystemFont(ofSize: 30)
- backgroundColor(red: 58/255, green: 58/255, blue: 58/255, alpha: 1.0)
- frame.size.height = 80
- frame.size.width = 80
- layer.cornerRadius = 40
- horizontalStackView 속성
- axis = .horizontal
- backgroundColor = .black
- spacing = 10
- distribution = .fillEqually
- horizontalStackView AutoLayout
- height = 80
- verticalStackView 속성
- axis = .vertical
- backgroundColor = .black
- spacing = 10
- distribution = . fillEqually
- horizontalStackView AutoLayout
- width = 350
- top = label의 bottom으로부터 60 떨어지도록
- centerX = superView와 같도록
'Today I Learned > 2024' 카테고리의 다른 글
24.06.26 Today I Learned (0) | 2024.06.26 |
---|---|
24.06.25 Today I Learned (0) | 2024.06.25 |
24.06.21 Today I Learned (0) | 2024.06.21 |
24.06.20 Today I Learned (0) | 2024.06.20 |
24.06.19 Today I Learned (0) | 2024.06.19 |