转载自 : http://www.cocoachina.com/bbs/read.php?tid=1706807
关于tableViewcell中套collectionview 崩溃
- (UICollectionView *)imageCollectView {
if (!_imageCollectView) {
UICollectionViewFlowLayout *flowLayot = [[UICollectionViewFlowLayout alloc] init];
flowLayot.scrollDirection = UICollectionViewScrollDirectionVertical;
_imageCollectView = [[UICollectionView alloc] initWithFrame:CGRectMake(0, 0, kIphoneWidth, kIphoneHeight) collectionViewLayout:flowLayot];
_imageCollectView.backgroundColor = kRGBColor(2, 243, 145, 1);
_imageCollectView.delegate = self;
_imageCollectView.dataSource = self;
[_imageCollectView registerNib:[UINib nibWithNibName:@"AddImageViewCollectionViewCell" bundle:nil] forCellWithReuseIdentifier:cellString];
[_imageCollectView registerNib:[UINib nibWithNibName:@"PatientImageCollectReuseView" bundle:nil] forSupplementaryViewOfKind:UICollectionElementKindSectionHeader withReuseIdentifier:reuseViewString];
}
return _imageCollectView;
}
- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath {
PatientImageCollectionViewCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:cellString forIndexPath:indexPath];
程序在这里奔溃
return cell;
}
此方法写在cell中的,没到return 就奔溃了
报错:thread 1 signal sigabrt
奔溃日志:
invalid mode 'kCFRunLoopCommonModes' provided to CFRunLoopRunSpecific - break on _CFRunLoopError_RunCalledWithInvalidMode to debug. This message will only appear once per execution.
libc++abi.dylib: terminate_handler unexpectedly threw an exception
求大神帮忙看看哪里有问题?
if (!_imageCollectView) {
UICollectionViewFlowLayout *flowLayot = [[UICollectionViewFlowLayout alloc] init];
flowLayot.scrollDirection = UICollectionViewScrollDirectionVertical;
_imageCollectView = [[UICollectionView alloc] initWithFrame:CGRectMake(0, 0, kIphoneWidth, kIphoneHeight) collectionViewLayout:flowLayot];
_imageCollectView.backgroundColor = kRGBColor(2, 243, 145, 1);
_imageCollectView.delegate = self;
_imageCollectView.dataSource = self;
[_imageCollectView registerNib:[UINib nibWithNibName:@"AddImageViewCollectionViewCell" bundle:nil] forCellWithReuseIdentifier:cellString];
[_imageCollectView registerNib:[UINib nibWithNibName:@"PatientImageCollectReuseView" bundle:nil] forSupplementaryViewOfKind:UICollectionElementKindSectionHeader withReuseIdentifier:reuseViewString];
}
return _imageCollectView;
}
- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath {
PatientImageCollectionViewCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:cellString forIndexPath:indexPath];
程序在这里奔溃
return cell;
}
此方法写在cell中的,没到return 就奔溃了
报错:thread 1 signal sigabrt
奔溃日志:
invalid mode 'kCFRunLoopCommonModes' provided to CFRunLoopRunSpecific - break on _CFRunLoopError_RunCalledWithInvalidMode to debug. This message will only appear once per execution.
libc++abi.dylib: terminate_handler unexpectedly threw an exception
求大神帮忙看看哪里有问题?
UITableViewCell方法的中的重用问题,需要给每个UITableViewCell赋予一个唯一重用标志符,只允许重用自己,不允许互相重用