質問するログイン新規登録

回答編集履歴

4

2018/06/05 13:40

投稿

_Kentarou
_Kentarou

スコア8490

answer CHANGED
@@ -9,7 +9,7 @@
9
9
  override func viewDidLoad() {
10
10
  super.viewDidLoad()
11
11
 
12
- // ラベル
12
+ // ラベルの場合
13
13
  let label = NSTextField(frame: NSRect(x: 20, y: 20, width: 150, height: 50))
14
14
  label.stringValue = "label"
15
15
  label.backgroundColor = NSColor.blue

3

s

2018/06/05 13:40

投稿

_Kentarou
_Kentarou

スコア8490

answer CHANGED
@@ -9,6 +9,7 @@
9
9
  override func viewDidLoad() {
10
10
  super.viewDidLoad()
11
11
 
12
+ // ラベル
12
13
  let label = NSTextField(frame: NSRect(x: 20, y: 20, width: 150, height: 50))
13
14
  label.stringValue = "label"
14
15
  label.backgroundColor = NSColor.blue

2

s

2018/06/05 13:10

投稿

_Kentarou
_Kentarou

スコア8490

answer CHANGED
@@ -1,1 +1,18 @@
1
- ラベルとテキストビューを作成して画面に追加してみましょう。
1
+ ラベルとテキストビューを作成して画面に追加してみましょう。
2
+
3
+ ```swift
4
+
5
+ import Cocoa
6
+
7
+ class ViewController: NSViewController {
8
+
9
+ override func viewDidLoad() {
10
+ super.viewDidLoad()
11
+
12
+ let label = NSTextField(frame: NSRect(x: 20, y: 20, width: 150, height: 50))
13
+ label.stringValue = "label"
14
+ label.backgroundColor = NSColor.blue
15
+ view.addSubview(label)
16
+ }
17
+ }
18
+ ```

1

s

2018/06/05 13:09

投稿

_Kentarou
_Kentarou

スコア8490

answer CHANGED
@@ -1,24 +1,1 @@
1
- ラベルとテキストビューを作成して画面に追加してみましょう。(コードで)
1
+ ラベルとテキストビューを作成して画面に追加してみましょう。
2
-
3
- ```swift
4
-
5
- import UIKit
6
-
7
- class ViewController: UIViewController {
8
-
9
- override func viewDidLoad() {
10
- super.viewDidLoad()
11
-
12
-
13
- let label = UILabel(frame: CGRect(x: 50, y: 50, width: 150, height: 50))
14
- label.backgroundColor = UIColor.yellow
15
- label.text = "Label - text"
16
- view.addSubview(label)
17
-
18
- let textView = UITextView(frame: CGRect(x: 50, y: 150, width: 150, height: 250))
19
- textView.backgroundColor = UIColor.green
20
- textView.text = "TextView - text"
21
- view.addSubview(textView)
22
- }
23
- }
24
- ```