I'm using RFQuiltLayout in for my uicollectionview
.
My storyboard contain Uiview
+ collectionview
. collectionview are IBOutleted
to my UiView
class and in my storyboard i'm using custom layout for my collectionview like this :
I'm loading my collectionview data from appdelegate
class so in first run it return 0
for numberOfItemsInSection
and after data get fetched from server it will load my collectionview.
Now problem is if i change the Layout to flow program works correctly but if i use custome class like RFQuiltLayout
no cell shows up ,
numberOfItemsInSection returns my actual value but cellForItemAtIndexPath not getting called.
The code in my ViewDidLoad
:
self.CV.delegate = self;
self.CV.dataSource = self;
[self.CV registerClass:[UICollectionViewCell class] forCellWithReuseIdentifier:@"MyCell"];
RFQuiltLayout* layout = (id)[self.CV collectionViewLayout];
layout.direction = UICollectionViewScrollDirectionVertical;
layout.blockPixels = CGSizeMake(75,75);
I'm also calling reloaddata
in viewDidAppear
.
and in appdelegate
:
ParseOperation *weakParser = parser;
parser.completionBlock = ^(void) {
if (weakParser.appRecordList) {
dispatch_async(dispatch_get_main_queue(), ^{
MyCollectionViewController *rootViewControllers = (MyCollectionViewController*)[(UINavigationController*)self.window.rootViewController topViewController];
rootViewControllers.entries = weakParser.appRecordList;
[rootViewControllers.CV.collectionViewLayout invalidateLayout];
[rootViewControllers.CV reloadData];
});
}
one thing is if i use this code in my delegate the uicollection shows up but without any custome layout and scrolling ability :
[rootViewControllers.CV reloadData];
NSMutableArray *indexPaths = [[NSMutableArray alloc] init];
NSIndexPath *indexPath;
for (int i = 0; i < [weakParser.appRecordList count]; i++) {
indexPath = [NSIndexPath indexPathForItem:i inSection:0];
[indexPaths addObject:indexPath];
}
[rootViewControllers.CV reloadItemsAtIndexPaths:indexPaths];
the methods inside RFQuiltLayout gets called but the method for layout inside
uiview like these "blockSizeForItemAtIndexPath" and
"blockSizeForItemAtIndexPath" not getting called.