質問編集履歴
2
コード追加
test
CHANGED
File without changes
|
test
CHANGED
@@ -6,45 +6,161 @@
|
|
6
6
|
|
7
7
|
|
8
8
|
|
9
|
-
```
|
9
|
+
```swift
|
10
10
|
|
11
11
|
// 遷移元
|
12
12
|
|
13
|
-
|
13
|
+
import UIKit
|
14
14
|
|
15
|
-
if segue.identifier == "toChatViewController" {
|
16
15
|
|
17
|
-
let nav = segue.destination as! UINavigationController
|
18
16
|
|
19
|
-
|
17
|
+
class AbcViewController: UIViewController {
|
20
18
|
|
21
|
-
|
19
|
+
|
22
20
|
|
21
|
+
@IBOutlet weak var scrollView: UIScrollView!
|
22
|
+
|
23
|
+
// ScrollScreenの高さ
|
24
|
+
|
25
|
+
var scrollScreenHeight:CGFloat!
|
26
|
+
|
27
|
+
// ScrollScreenの幅
|
28
|
+
|
29
|
+
var scrollScreenWidth:CGFloat!
|
30
|
+
|
31
|
+
|
32
|
+
|
33
|
+
var screenSize:CGRect!
|
34
|
+
|
35
|
+
|
36
|
+
|
37
|
+
override func viewDidLoad() {
|
38
|
+
|
39
|
+
super.viewDidLoad()
|
40
|
+
|
41
|
+
|
42
|
+
|
43
|
+
screenSize = UIScreen.main.bounds
|
44
|
+
|
45
|
+
// ページスクロールとするためにページ幅を合わせる
|
46
|
+
|
47
|
+
scrollScreenWidth = screenSize.width
|
48
|
+
|
49
|
+
scrollScreenHeight = screenSize.height
|
50
|
+
|
51
|
+
|
52
|
+
|
23
|
-
|
53
|
+
setupFirebase()
|
24
54
|
|
25
55
|
}
|
26
56
|
|
27
57
|
|
28
58
|
|
29
|
-
|
59
|
+
func setupFirebase() {
|
30
60
|
|
31
|
-
tabBarController?.tabBar.isHidden = true
|
32
61
|
|
62
|
+
|
63
|
+
// 自作セルをテーブルビューに登録する
|
64
|
+
|
65
|
+
let communityXib = UINib(nibName: "CommunityTableViewCell", bundle: Bundle(for: type(of: self)))
|
66
|
+
|
67
|
+
|
68
|
+
|
69
|
+
// 描画開始の x,y 位置
|
70
|
+
|
71
|
+
let px:CGFloat = 0.0
|
72
|
+
|
73
|
+
var py:CGFloat = 0.0
|
74
|
+
|
75
|
+
|
76
|
+
|
77
|
+
let communityView = communityXib.instantiate(withOwner: self, options: nil).first as! UIView
|
78
|
+
|
79
|
+
communityView.isUserInteractionEnabled = true
|
80
|
+
|
81
|
+
print("あああ")
|
82
|
+
|
83
|
+
let gesture = UITapGestureRecognizer(target: self, action: #selector(AbcViewController.btnClick(sender:forEvent:)))
|
84
|
+
|
85
|
+
|
86
|
+
|
87
|
+
communityView.addGestureRecognizer(gesture)
|
88
|
+
|
89
|
+
self.scrollView.addSubview(communityView)
|
90
|
+
|
91
|
+
|
92
|
+
|
93
|
+
// 描画開始設定
|
94
|
+
|
95
|
+
var viewFrame:CGRect = communityView.frame
|
96
|
+
|
97
|
+
viewFrame.size.width = self.scrollScreenWidth
|
98
|
+
|
99
|
+
viewFrame.size.height = self.scrollScreenHeight
|
100
|
+
|
101
|
+
viewFrame.origin = CGPoint(x: px, y: py)
|
102
|
+
|
103
|
+
communityView.frame = viewFrame
|
104
|
+
|
105
|
+
// 次の描画位置設定
|
106
|
+
|
107
|
+
py += (self.screenSize.height)
|
108
|
+
|
109
|
+
|
110
|
+
|
111
|
+
// スクロール範囲の設定
|
112
|
+
|
113
|
+
let nHeight:CGFloat = self.scrollScreenHeight * CGFloat(1)
|
114
|
+
|
115
|
+
self.scrollView.contentSize = CGSize(width: self.scrollScreenWidth, height: nHeight)
|
116
|
+
|
117
|
+
}
|
118
|
+
|
119
|
+
|
120
|
+
|
121
|
+
@objc func btnClick(sender:UITapGestureRecognizer, forEvent event: UIEvent) {
|
122
|
+
|
123
|
+
print("ムカつく")
|
124
|
+
|
33
|
-
performSegue(withIdentifier: "to
|
125
|
+
performSegue(withIdentifier: "toTest", sender: nil)
|
34
126
|
|
35
127
|
}
|
36
128
|
|
37
129
|
|
38
130
|
|
39
|
-
|
131
|
+
}
|
40
132
|
|
133
|
+
|
134
|
+
|
135
|
+
```
|
136
|
+
|
137
|
+
```swift
|
138
|
+
|
139
|
+
//遷移先
|
140
|
+
|
141
|
+
import UIKit
|
142
|
+
|
143
|
+
|
144
|
+
|
145
|
+
class DefViewController: UIViewController {
|
146
|
+
|
147
|
+
|
148
|
+
|
149
|
+
override func viewDidLoad() {
|
150
|
+
|
151
|
+
super.viewDidLoad()
|
152
|
+
|
153
|
+
}
|
154
|
+
|
155
|
+
|
156
|
+
|
41
|
-
@IBAction func close
|
157
|
+
@IBAction func closePage(_ sender: Any) {
|
42
158
|
|
43
159
|
self.dismiss(animated: true, completion: nil)
|
44
160
|
|
45
161
|
}
|
46
162
|
|
47
|
-
|
163
|
+
}
|
48
164
|
|
49
165
|
|
50
166
|
|
1
画像追加
test
CHANGED
File without changes
|
test
CHANGED
@@ -49,3 +49,7 @@
|
|
49
49
|
|
50
50
|
|
51
51
|
```
|
52
|
+
|
53
|
+
|
54
|
+
|
55
|
+
![イメージ説明](be2a57a364aa52b8f23841c737061ed9.png)
|