Can't initiate the FbLikeLayout
Closed this issue · 1 comments
chlebta commented
Hello, this's my code :
- (UICollectionView *)collectionView {
if (!_collectionView) {
CGRect collectionViewFrame = self.view.bounds;
collectionViewFrame.size.height -= (self.navigationController.viewControllers.count > 1 ? 0 : (CGRectGetHeight(self.tabBarController.tabBar.bounds))) + 0;
//FMMosaicLayout *mosaicLayout = [[FMMosaicLayout alloc] init];
FBLikeLayout *layout = [FBLikeLayout new];
layout.minimumInteritemSpacing = 5;
layout.singleCellWidth = (MIN(self.collectionView.bounds.size.width, self.collectionView.bounds.size.height)-self.collectionView.contentInset.left-self.collectionView.contentInset.right-8)/3.0;
layout.maxCellSpace = 2;
layout.forceCellWidthForMinimumInteritemSpacing = YES;
layout.fullImagePercentageOfOccurrency = 50;
_collectionView = [[UICollectionView alloc] initWithFrame:collectionViewFrame collectionViewLayout:layout];
_collectionView.delegate = self;
_collectionView.dataSource = self;
}
return _collectionView;
}
When my App reach this line *FBLikeLayout layout = [FBLikeLayout new]; it stuck there with EXC_BAD_ACC error , how to fix it please ?
gringoireDM commented
You are calling self.collectionView in the collectionView getter, and more than all BEFORE you allocate it, incurring in an infinite loop.... Man, don't open issues on something that works. Please, just see what i have done in the sample code.