목록랜덤함수 (1)
어흥
[Swift] String + Variable(변수)
1. 사용방법: 변수 2개 사용(String, 다른 변수) 2. 간단한 예시 let name = "어흥" let msg = "My name is \(name)!" print(msg) 3. 응용 예시 (Alert, 랜덤함수 사용) class ViewController: UIViewController { var curVal = 0 override func viewDidLoad(){ // } @IBAction func hello(_sender:Any){ let randomPrice = arc4random_uniform(10000)+1 // 1~10000사이의 랜던 숫자 curVal = Int(randomPrice)//randomPrice가 uInt형태기 때문에 형변환 let msg = "현재 물품의 가격은 \..
iOS
2020. 8. 20. 09:17