iOSアプリの開発を始めてみる
swiftを使って、iOSアプリの勉強を始める。
とりあえずHello, world!を表示してみる。
Xcodeは、Ver.7が既にインストールされている状態です。
Hello, worldを表示
ViewController.swiftを選んで、viewDidLoadのメソッドに下記のコードを追加する。
// コンソールにHello, worldを表示 print("Hello, world!") // アラートでHello, worldを表示 let alert = UIAlertView() alert.message = "Hello, world!" alert.addButtonWithTitle("OK") alert.show() // ラベルでHello, world let label: UILabel = UILabel(frame: CGRectMake(0,0,100,20)) label.text = "Hello, world!" label.layer.position = CGPoint(x: 50, y: 30) self.view.addSubview(label)