728x90
반응형
백그라운드 색상 변경하기
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 32 33 34 35 36 37 38 | import UIKit class ViewController: UIViewController { override func viewDidLoad() { super.viewDidLoad() // Do any additional setup after loading the view, typically from a nib. // BackGround Color -- R, G, B, Alpha self.view.backgroundColor = UIColor(red: 0.9, green: 0.3, blue: 0.5, alpha: 0.3) // Get width, height Size var width : CGFloat = self.view.frame.size.width var height : CGFloat = self.view.frame.size.height // Title UILabel var titleTxt = UILabel(frame: CGRectMake(0, height/2, width, height/6)) // Text titleTxt.text = "Hello Swift" // Alignment titleTxt.textAlignment = NSTextAlignment.Center // Font titleTxt.font = UIFont(name: "System", size: 40) // Color titleTxt.textColor = UIColor(red: 1, green: 1, blue: 1, alpha: 1) // Display self.view.addSubview(titleTxt) } override func didReceiveMemoryWarning() { super.didReceiveMemoryWarning() // Dispose of any resources that can be recreated. } } | cs |
- 추가 부분
self.view.backgroundColor = UIColor(red: 0.9, green: 0.3, blue: 0.5, alpha: 0.3)
- 출력 결과 화면
728x90
반응형
'Programming > ios' 카테고리의 다른 글
'GoogleSignIn/GIDSignIn.h' file not found (0) | 2017.03.20 |
---|---|
module 'googlemobileads' not found (0) | 2017.03.20 |
[swift를 이용한 ios 앱 만들기] 화면 전환 (0) | 2015.12.30 |
[swift를 이용한 ios 앱 만들기] 버튼 만들기 (0) | 2015.12.30 |
[swift를 이용한 ios 앱 개발] UILable을 이용하여 Text 넣기 (0) | 2015.12.30 |
댓글