回答編集履歴
1
追加
answer
CHANGED
@@ -11,4 +11,26 @@
|
|
11
11
|
// let scrollView = UIScrollView() 外に移動
|
12
12
|
|
13
13
|
|
14
|
+
```
|
15
|
+
|
16
|
+
## 追加 ストボーを使わないで真ん中に表示
|
17
|
+
|
18
|
+
```swift
|
19
|
+
|
20
|
+
internal func onClickMyButton1(sender: UIButton) {
|
21
|
+
|
22
|
+
let lo = UIImage(named:"menu.png")
|
23
|
+
|
24
|
+
// 画像のサイズを100x100と仮定。画面のセンター(x,y)から画像サイズの半分を引く
|
25
|
+
let menu = UIImageView(frame:CGRect(x:self.view.center.x-50,y:self.view.center.y-50,width:100,height:100))
|
26
|
+
|
27
|
+
/* // 上の一行と同じ処理
|
28
|
+
let menu = UIImageView(frame:CGRect(x:0,y:0,width:100,height:100))
|
29
|
+
menu.center = self.view.center
|
30
|
+
*/
|
31
|
+
|
32
|
+
menu.image = lo
|
33
|
+
|
34
|
+
self.view.addSubview(menu)
|
35
|
+
}
|
14
36
|
```
|