0
내
의 UIViewController에서 UICollectionViewCell
변경 항목이 같은 선언 UICollectionViewCell
내에서 특정 항목의 크기를 변경하기 위해 노력하고있어
내부 크기 :
func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
let cell = collectionView.dequeueReusableCell(withReuseIdentifier: Storyboard.CellIdentifier, for: indexPath) as! NameCollectionViewCell
if(retreivedEvents == nil) {
// print("data not received yet...")
return cell
} else {
// print("new data given")
cell.anEvent = self.retreivedEvents![indexPath.row]
cell.setNeedsLayout()
return cell
}
}
func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAtIndexPath indexPath: IndexPath) -> CGSize {
let cell2 = collectionView.dequeueReusableCell(withReuseIdentifier: Storyboard.CellIdentifier, for: indexPath) as! NameCollectionViewCell
let screenHeigh = UIScreen.main.bounds.size.height
cell2.frame.size.height = cellSize * 0.8
cell2.descriptionTextView.frame.size.height += 50
cell2.theImageView.frame.size.height = cellSize * 0.8
let layout = collectionView.collectionViewLayout as! UICollectionViewFlowLayout
layout.sectionInset = UIEdgeInsets(top: 0, left: 10, bottom: 0, right: 10)
return CGSize(width: self.collectionView.frame.width,height:cell2.frame.size.height)
}
문제 : 때마다 나는 그것을 실행하면 콘솔이 표시됩니다
ty의 캐치되지 않는 예외로 종료 pe NSException
. 나는 그 오류가 무엇인지 모르겠다.
정보를 더 공유 할 수 있습니까? 앱이 어디에서 충돌했는지 (코드 줄)? –
@JimmyJames 안녕하세요, 네. AppDelegate.swift 안에 있습니다. *** 캐치되지 않은 예외 'NSRangeException'으로 인한 응용 프로그램 종료, 이유 : '*** - [NSArrayM objectAtIndex :] : 경계 1을 넘어서는 색인 1' – WoShiNiBaBa
디버그를 위해 예외 브레이크 포인트 배치 –