回答編集履歴
1
追加
test
CHANGED
@@ -25,3 +25,47 @@
|
|
25
25
|
|
26
26
|
|
27
27
|
```
|
28
|
+
|
29
|
+
|
30
|
+
|
31
|
+
## 追加 ストボーを使わないで真ん中に表示
|
32
|
+
|
33
|
+
|
34
|
+
|
35
|
+
```swift
|
36
|
+
|
37
|
+
|
38
|
+
|
39
|
+
internal func onClickMyButton1(sender: UIButton) {
|
40
|
+
|
41
|
+
|
42
|
+
|
43
|
+
let lo = UIImage(named:"menu.png")
|
44
|
+
|
45
|
+
|
46
|
+
|
47
|
+
// 画像のサイズを100x100と仮定。画面のセンター(x,y)から画像サイズの半分を引く
|
48
|
+
|
49
|
+
let menu = UIImageView(frame:CGRect(x:self.view.center.x-50,y:self.view.center.y-50,width:100,height:100))
|
50
|
+
|
51
|
+
|
52
|
+
|
53
|
+
/* // 上の一行と同じ処理
|
54
|
+
|
55
|
+
let menu = UIImageView(frame:CGRect(x:0,y:0,width:100,height:100))
|
56
|
+
|
57
|
+
menu.center = self.view.center
|
58
|
+
|
59
|
+
*/
|
60
|
+
|
61
|
+
|
62
|
+
|
63
|
+
menu.image = lo
|
64
|
+
|
65
|
+
|
66
|
+
|
67
|
+
self.view.addSubview(menu)
|
68
|
+
|
69
|
+
}
|
70
|
+
|
71
|
+
```
|