Swift 3.0
//
// ViewController.swift
// config002
//
// Copyright © 2016年 FaBo, Inc. All rights reserved.
//
import UIKit
class ViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
// 背景を青に.
self.view.backgroundColor = UIColor.blue
// 画面右下に表示.
let myLabel: UILabel = UILabel()
let labelWidth: CGFloat = 120
let labelHeight: CGFloat = 20
let posX: CGFloat = self.view.bounds.width - labelWidth
let posY: CGFloat = self.view.bounds.height - labelHeight
myLabel.frame = CGRect(x: posX, y: posY, width: labelWidth, height: labelHeight)
myLabel.textColor = UIColor.white
self.view.addSubview(myLabel)
#if TARGET_DEBUG
myLabel.text = "Developer"
#else
myLabel.text = "Destribution"
#endif
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
}
Swift 2.3
//
// ViewController.swift
// config002
//
// Copyright © 2016年 FaBo, Inc. All rights reserved.
//
import UIKit
class ViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
// 背景を青に.
self.view.backgroundColor = UIColor.blueColor()
// 画面右下に表示.
let myLabel: UILabel = UILabel()
let labelWidth: CGFloat = 120
let labelHeight: CGFloat = 20
let posX: CGFloat = self.view.bounds.width - labelWidth
let posY: CGFloat = self.view.bounds.height - labelHeight
myLabel.frame = CGRectMake(posX, posY, labelWidth, labelHeight)
myLabel.textColor = UIColor.whiteColor()
self.view.addSubview(myLabel)
#if TARGET_DEBUG
myLabel.text = "Developer"
#else
myLabel.text = "Destribution"
#endif
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
}
2.xと3.xの差分
Be the first to comment
You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.