質問編集履歴
3
console文
test
CHANGED
File without changes
|
test
CHANGED
@@ -218,6 +218,48 @@
|
|
218
218
|
|
219
219
|
|
220
220
|
|
221
|
+
コンソール情報
|
222
|
+
|
223
|
+
btと入力した結果の全文です。
|
224
|
+
|
225
|
+
```swift
|
226
|
+
|
227
|
+
* thread #1, queue = 'com.apple.main-thread', stop reason = signal SIGABRT
|
228
|
+
|
229
|
+
frame #0: 0x000000010da29d42 libsystem_kernel.dylib`__pthread_kill + 10
|
230
|
+
|
231
|
+
frame #1: 0x000000010da61457 libsystem_pthread.dylib`pthread_kill + 90
|
232
|
+
|
233
|
+
frame #2: 0x000000010d7bb88f libsystem_c.dylib`abort + 127
|
234
|
+
|
235
|
+
frame #3: 0x000000010cc9bce5 libc++abi.dylib`abort_message + 245
|
236
|
+
|
237
|
+
frame #4: 0x000000010ccb6cbd libc++abi.dylib`default_terminate_handler() + 265
|
238
|
+
|
239
|
+
frame #5: 0x000000010a3923c4 libobjc.A.dylib`_objc_terminate() + 103
|
240
|
+
|
241
|
+
frame #6: 0x000000010ccb3f29 libc++abi.dylib`std::__terminate(void (*)()) + 8
|
242
|
+
|
243
|
+
frame #7: 0x000000010ccb3bbe libc++abi.dylib`__cxa_rethrow + 99
|
244
|
+
|
245
|
+
frame #8: 0x000000010a3922dc libobjc.A.dylib`objc_exception_rethrow + 40
|
246
|
+
|
247
|
+
frame #9: 0x000000010a8b8096 CoreFoundation`CFRunLoopRunSpecific + 534
|
248
|
+
|
249
|
+
frame #10: 0x000000010e9cfa24 GraphicsServices`GSEventRunModal + 62
|
250
|
+
|
251
|
+
frame #11: 0x000000010b43a134 UIKit`UIApplicationMain + 159
|
252
|
+
|
253
|
+
* frame #12: 0x0000000108961877 cellectionView`main at AppDelegate.swift:13
|
254
|
+
|
255
|
+
frame #13: 0x000000010d71365d libdyld.dylib`start + 1
|
256
|
+
|
257
|
+
frame #14: 0x000000010d71365d libdyld.dylib`start + 1
|
258
|
+
|
259
|
+
```
|
260
|
+
|
261
|
+
|
262
|
+
|
221
263
|
|
222
264
|
|
223
265
|
情報不足で申し訳ありません。よろしくお願いいたします。
|
2
collectionviewのレイアウト情報
test
CHANGED
File without changes
|
test
CHANGED
@@ -52,4 +52,172 @@
|
|
52
52
|
|
53
53
|
|
54
54
|
|
55
|
+
collectionViewのレイアウト
|
56
|
+
|
57
|
+
レイアウトは自作のものを使っています。
|
58
|
+
|
59
|
+
```swift
|
60
|
+
|
61
|
+
import UIKit
|
62
|
+
|
63
|
+
|
64
|
+
|
65
|
+
class TestCollectionViewLayout: UICollectionViewLayout {
|
66
|
+
|
67
|
+
|
68
|
+
|
69
|
+
let numberColumns = 2 //列数
|
70
|
+
|
71
|
+
var height:CGFloat = 200 //セルの高さ
|
72
|
+
|
73
|
+
|
74
|
+
|
75
|
+
//レイアウト配列
|
76
|
+
|
77
|
+
private var layoutData = [UICollectionViewLayoutAttributes]()
|
78
|
+
|
79
|
+
|
80
|
+
|
81
|
+
//レイアウトを準備するメソッド
|
82
|
+
|
83
|
+
override func prepare() {
|
84
|
+
|
85
|
+
//全体の幅
|
86
|
+
|
87
|
+
let allWidth = collectionView!.bounds.width - collectionView!.contentInset.left - collectionView!.contentInset.right
|
88
|
+
|
89
|
+
|
90
|
+
|
91
|
+
let widthSecond = collectionView!.frame.width ///多分使わない
|
92
|
+
|
93
|
+
|
94
|
+
|
95
|
+
//列の幅
|
96
|
+
|
97
|
+
let columnWidth = widthSecond / CGFloat(numberColumns) ///元はallwidth
|
98
|
+
|
99
|
+
height = columnWidth
|
100
|
+
|
101
|
+
|
102
|
+
|
103
|
+
|
104
|
+
|
105
|
+
//座標
|
106
|
+
|
107
|
+
var y:CGFloat = 0
|
108
|
+
|
109
|
+
var x:CGFloat = 0
|
110
|
+
|
111
|
+
|
112
|
+
|
113
|
+
//要素数ぶんループ
|
114
|
+
|
115
|
+
for count in 0 ..< collectionView!.numberOfItems(inSection: 0) {
|
116
|
+
|
117
|
+
|
118
|
+
|
119
|
+
let indexPath = NSIndexPath(item:count, section:0)
|
120
|
+
|
121
|
+
|
122
|
+
|
123
|
+
//レイアウトの配列に位置とサイズを登録する。
|
124
|
+
|
125
|
+
let frame = CGRect(x:x, y:y, width:columnWidth, height: height)
|
126
|
+
|
127
|
+
let attributes = UICollectionViewLayoutAttributes(forCellWith: indexPath as IndexPath)
|
128
|
+
|
129
|
+
attributes.frame = frame
|
130
|
+
|
131
|
+
layoutData.append(attributes)
|
132
|
+
|
133
|
+
|
134
|
+
|
135
|
+
//X座標を更新
|
136
|
+
|
137
|
+
if(count % 2 == 0) {
|
138
|
+
|
139
|
+
x = columnWidth
|
140
|
+
|
141
|
+
} else {
|
142
|
+
|
143
|
+
x = 0
|
144
|
+
|
145
|
+
}
|
146
|
+
|
147
|
+
|
148
|
+
|
149
|
+
|
150
|
+
|
151
|
+
//Y座標を更新
|
152
|
+
|
153
|
+
if(count % 2 != 0){
|
154
|
+
|
155
|
+
y = y + height
|
156
|
+
|
157
|
+
}
|
158
|
+
|
159
|
+
}
|
160
|
+
|
161
|
+
}
|
162
|
+
|
163
|
+
|
164
|
+
|
165
|
+
|
166
|
+
|
167
|
+
|
168
|
+
|
169
|
+
//レイアウトを返すメソッド
|
170
|
+
|
171
|
+
override func layoutAttributesForElements(in rect: CGRect) -> [UICollectionViewLayoutAttributes]? {
|
172
|
+
|
173
|
+
return layoutData
|
174
|
+
|
175
|
+
}
|
176
|
+
|
177
|
+
|
178
|
+
|
179
|
+
|
180
|
+
|
181
|
+
|
182
|
+
|
183
|
+
//全体サイズを返すメソッド
|
184
|
+
|
185
|
+
override var collectionViewContentSize:CGSize {
|
186
|
+
|
187
|
+
//全体の幅
|
188
|
+
|
189
|
+
let allWidth = collectionView!.bounds.width - collectionView!.contentInset.left - collectionView!.contentInset.right
|
190
|
+
|
191
|
+
|
192
|
+
|
193
|
+
let widthSecond = collectionView!.frame.width///この辺いじった
|
194
|
+
|
195
|
+
height = widthSecond / CGFloat(numberColumns)
|
196
|
+
|
197
|
+
|
198
|
+
|
199
|
+
//全体の高さ
|
200
|
+
|
201
|
+
let allHeight = CGFloat(collectionView!.numberOfItems(inSection: 0)) * height / 2
|
202
|
+
|
203
|
+
|
204
|
+
|
205
|
+
return CGSize(width:widthSecond, height:allHeight) ////いじった
|
206
|
+
|
207
|
+
}
|
208
|
+
|
209
|
+
|
210
|
+
|
211
|
+
}
|
212
|
+
|
213
|
+
|
214
|
+
|
215
|
+
```
|
216
|
+
|
217
|
+
collectionViewは1つだけです。
|
218
|
+
|
219
|
+
|
220
|
+
|
221
|
+
|
222
|
+
|
55
223
|
情報不足で申し訳ありません。よろしくお願いいたします。
|
1
情報の追加
test
CHANGED
File without changes
|
test
CHANGED
@@ -27,3 +27,29 @@
|
|
27
27
|
|
28
28
|
|
29
29
|
performBatchUpdate()を使うという情報を見つけましたが、update(() -> void)の箇所に何を入力すればいいのか理解できませんでした。
|
30
|
+
|
31
|
+
|
32
|
+
|
33
|
+
|
34
|
+
|
35
|
+
エラー内容
|
36
|
+
|
37
|
+
![イメージ説明](f2a887d83b1171fd68ee6835729688c2.png)
|
38
|
+
|
39
|
+
|
40
|
+
|
41
|
+
発生場所
|
42
|
+
|
43
|
+
![イメージ説明](03c5451c1db37e1f8f24f6bf280ce7a7.png)
|
44
|
+
|
45
|
+
|
46
|
+
|
47
|
+
削除コード場所
|
48
|
+
|
49
|
+
アクションシートを使って画像を削除しようとしています。
|
50
|
+
|
51
|
+
![イメージ説明](f90a7dc0ea5b9fa5d784ae8aeb09439a.png)
|
52
|
+
|
53
|
+
|
54
|
+
|
55
|
+
情報不足で申し訳ありません。よろしくお願いいたします。
|