大重美幸著「詳細!Swift3 iPhoneアプリ開発入門ノート」
半分ほど読んだところです。
InterfaceBuilderを使わずにコードだけで文字を表示するお手本が出てきたので、
これをほんの少し改変して、やっと本当のhello, worldを体験しました![]()
![]()
これですよ、こうでなくっちゃ![]()
実機でテストするのも初体験。実にワクワクします![]()
//
// ViewController.swift
// helloworld
//
import UIKit
class ViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
let myLabel = UILabel()
myLabel.text = "hello, world"
myLabel.frame = CGRect(x: 0, y: 0, width: 200, height: 48)
myLabel.textColor = UIColor.green
view.backgroundColor = UIColor.black
view.addSubview(myLabel)
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
}
