質問編集履歴

5

修正

2018/03/08 09:04

投稿

退会済みユーザー
test CHANGED
File without changes
test CHANGED
@@ -80,7 +80,7 @@
80
80
 
81
81
  下記コードを追記しました。
82
82
 
83
- RUNが成功したのシミュレーター画像を追記しました。
83
+ RUNが成功した場合のシミュレーター画像を追記しました。
84
84
 
85
85
 
86
86
 

4

修正

2018/03/08 09:04

投稿

退会済みユーザー
test CHANGED
File without changes
test CHANGED
@@ -90,16 +90,12 @@
90
90
 
91
91
 
92
92
 
93
-
94
-
95
93
  ```
96
94
 
97
95
  import UIKit
98
96
 
99
97
 
100
98
 
101
- //クラス
102
-
103
99
  class ProfileController: UICollectionViewController, UICollectionViewDelegateFlowLayout {
104
100
 
105
101
  override func viewDidLoad() {
@@ -162,8 +158,6 @@
162
158
 
163
159
 
164
160
 
165
- // プロファイル クラス
166
-
167
161
  class ProfileCell: UICollectionViewCell {
168
162
 
169
163
  override init(frame: CGRect) {
@@ -176,8 +170,6 @@
176
170
 
177
171
 
178
172
 
179
- //プロファイル
180
-
181
173
  let profileImageView: UIImageView = {
182
174
 
183
175
  let imageView = UIImageView()

3

修正

2018/03/08 09:03

投稿

退会済みユーザー
test CHANGED
File without changes
test CHANGED
@@ -80,13 +80,19 @@
80
80
 
81
81
  下記コードを追記しました。
82
82
 
83
-
83
+ RUNが成功した時のシミュレーター画像を追記しました。
84
+
85
+
86
+
87
+
88
+
84
-
89
+ ![イメージ説明](ab1881b4561e586efa0626849ec5279b.png)
90
+
91
+
92
+
93
+
94
+
85
- ```ここに言語を入力
95
+ ```
86
-
87
-
88
-
89
-
90
96
 
91
97
  import UIKit
92
98
 

2

修正

2018/03/08 09:02

投稿

退会済みユーザー
test CHANGED
File without changes
test CHANGED
@@ -92,7 +92,7 @@
92
92
 
93
93
 
94
94
 
95
- //クラス????
95
+ //クラス
96
96
 
97
97
  class ProfileController: UICollectionViewController, UICollectionViewDelegateFlowLayout {
98
98
 

1

修正

2018/03/08 08:56

投稿

退会済みユーザー
test CHANGED
File without changes
test CHANGED
@@ -69,3 +69,207 @@
69
69
 
70
70
 
71
71
  よろしくお願いします。
72
+
73
+
74
+
75
+
76
+
77
+
78
+
79
+ //
80
+
81
+ 下記コードを追記しました。
82
+
83
+
84
+
85
+ ```ここに言語を入力
86
+
87
+
88
+
89
+
90
+
91
+ import UIKit
92
+
93
+
94
+
95
+ //クラス????
96
+
97
+ class ProfileController: UICollectionViewController, UICollectionViewDelegateFlowLayout {
98
+
99
+ override func viewDidLoad() {
100
+
101
+ super.viewDidLoad()
102
+
103
+
104
+
105
+ navigationItem.title = "プロフ"
106
+
107
+ collectionView?.backgroundColor = .white
108
+
109
+ collectionView?.register(ProfileCell.self, forCellWithReuseIdentifier: "cellId")
110
+
111
+ }
112
+
113
+
114
+
115
+
116
+
117
+ override func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
118
+
119
+ return 5
120
+
121
+ }
122
+
123
+
124
+
125
+ override func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
126
+
127
+ let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "cellId", for: indexPath)
128
+
129
+
130
+
131
+ return cell
132
+
133
+ }
134
+
135
+
136
+
137
+ func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize {
138
+
139
+
140
+
141
+ return CGSize(width: view.frame.width, height: 200)
142
+
143
+ }
144
+
145
+
146
+
147
+ func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, minimumLineSpacingForSectionAt section: Int) -> CGFloat {
148
+
149
+
150
+
151
+ return 0
152
+
153
+ }
154
+
155
+
156
+
157
+
158
+
159
+ // プロファイル クラス
160
+
161
+ class ProfileCell: UICollectionViewCell {
162
+
163
+ override init(frame: CGRect) {
164
+
165
+ super.init(frame: frame)
166
+
167
+ setupViews()
168
+
169
+ }
170
+
171
+
172
+
173
+ //プロファイル
174
+
175
+ let profileImageView: UIImageView = {
176
+
177
+ let imageView = UIImageView()
178
+
179
+ imageView.backgroundColor = .blue
180
+
181
+ imageView.translatesAutoresizingMaskIntoConstraints = false
182
+
183
+
184
+
185
+ return imageView
186
+
187
+ }()
188
+
189
+
190
+
191
+ let separatorView: UIView = {
192
+
193
+ let view = UIView()
194
+
195
+ view.backgroundColor = .blue
196
+
197
+ view.translatesAutoresizingMaskIntoConstraints = false
198
+
199
+ return view
200
+
201
+ }()
202
+
203
+
204
+
205
+
206
+
207
+ func setupViews() {
208
+
209
+
210
+
211
+ addSubview(profileImageView)
212
+
213
+ addSubview(separatorView)
214
+
215
+
216
+
217
+ addConstraintsWithFormat("H:|-16-[v0]-16-|", views: profileImageView)
218
+
219
+ addConstraintsWithFormat("V:|-16-[v0]-16-[v1(1)]|", views: separatorView)
220
+
221
+ addConstraintsWithFormat("H:|[v0]|", views: separatorView)
222
+
223
+
224
+
225
+ }
226
+
227
+
228
+
229
+ required init?(coder aDecoder: NSCoder) {
230
+
231
+ fatalError("init(coder:) has not been implemented")
232
+
233
+ }
234
+
235
+ }
236
+
237
+
238
+
239
+ extension UIView {
240
+
241
+ func addConstraintsWithFormat(format: String, views: UIView...) {
242
+
243
+
244
+
245
+ var viewsDictionary = [String: UIView]()
246
+
247
+ for (index, view) in views.enumerated() {
248
+
249
+ let key = "v(index)"
250
+
251
+ viewsDictionary[key] = view
252
+
253
+ }
254
+
255
+
256
+
257
+ addConstraints(NSLayoutConstraint.constraints(withVisualFormat: format, options:
258
+
259
+ NSLayoutFormatOptions(), metrics: nil, views: viewsDictionary))
260
+
261
+
262
+
263
+ }
264
+
265
+ }
266
+
267
+
268
+
269
+ }
270
+
271
+
272
+
273
+
274
+
275
+ ```