일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | |||
5 | 6 | 7 | 8 | 9 | 10 | 11 |
12 | 13 | 14 | 15 | 16 | 17 | 18 |
19 | 20 | 21 | 22 | 23 | 24 | 25 |
26 | 27 | 28 | 29 | 30 | 31 |
Tags
- 케쉴주
- John the ripper
- ZIP
- crack
- 디스크
- Mobile
- Reversing
- Interceptor
- 써니나타스
- swing
- tar
- 파일해시생성
- K-shield Jr 10기
- 포렌식
- 리버싱핵심원리
- Autoware
- 침해사고대응
- shadow
- upx
- Frida
- CodeEngn
- Multimedia
- 안티디버깅
- ctf-d
- SW에듀서포터즈
- K-sheild Jr
- disk
- 모바일프로그래밍
- Android
Archives
- Today
- Total
물먹는산세베리아
[swift] 직사각형 넓이 구하기 본문
ViewController.swift
//
// ViewController.swift
// BMICalc
//
// Created by swuad_26 on 2022/01/03.
//
import UIKit
class ViewController: UIViewController {
@IBOutlet weak var label1: UITextField!
@IBOutlet weak var label2: UITextField!
@IBOutlet weak var label3: UITextField!
let numberFormatter:NumberFormatter = {
let nf = NumberFormatter()
nf.numberStyle = .decimal
nf.minimumFractionDigits = 0
nf.maximumFractionDigits = 2
return nf
}()
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view.
}
@IBAction func doConvert(_ sender: UIButton) {
if let value1 = label1.text, let num1 = Double(value1){
if let value2 = label2.text, let num2 = Double(value2){
let area = num1 * num2
label3.text = numberFormatter.string(from: NSNumber(value: area))
label1.resignFirstResponder()
label2.resignFirstResponder()
}
}
}
@IBAction func dismissKeyboard(_ sender: Any) {
label1.resignFirstResponder()
label2.resignFirstResponder()
label3.resignFirstResponder()
}
}