eoghain / RBCollectionViewInfoFolderLayout

A UICollectionViewLayout that displays a folder of extra information below your items.
MIT License
92 stars 10 forks source link

How to use the slide out data view on a separate project #2

Closed shrishaster closed 10 years ago

shrishaster commented 10 years ago

I really like the slide down data view in my own project.

I need help in identifying as to which code is actually doing it?

eoghain commented 10 years ago

The code in the RBCollectionViewInfoFolderLayout.h/.m is what does the work on a collection view. As long as you are building a collection view you can use that layout and implement the delegate methods as outlined in the README.

I guess I'm confused as to what you are asking for.

If you want to know how my folder data gets populated it's using my custom ComicDataView class that was registered as the RBCollectionViewInfoFolderKind supplimentary view. I then populate this view in the - (UICollectionReusableView )collectionView:(UICollectionView )collectionView viewForSupplementaryElementOfKind:(NSString )kind atIndexPath:(NSIndexPath )indexPath delegate method.

shrishaster commented 10 years ago

Hi Thank you for the reply.

I did like you said. Now the obstacle is that in your project you are directly using a UICollectionViewController but I am using a UIViewController and then adding a UICollectionView to it. While do this I get an error on the line '_collectionView=[[UICollectionView alloc] initWithFrame:CGRectMake(0, 97.5, self.view.frame.size.width, self.view.frame.size.height-67.5) collectionViewLayout:layout];'

What should I do?

eoghain commented 10 years ago

What error are you getting? If you are trying to have a non-full screen UICollectionView I've found setting it up as an embedded view into another UIViewController is very easy and keeps my code clean. However, a UICollectionViewController is just a UIViewController with a pre-set collectionview outlet and delegate methods, so by manually adding your UICollectionView to your UIViewController you just need to make all of those connections yourself.

shrishaster commented 10 years ago

So I have fixed this issue. I was actually passing a nil layout.

Now the project is running but the delegate functions of UICollectionView like numberOfItemsInSection and cellForItemAtIndexPath are not getting executed.

But the following delegates are getting executed: [_collectionView setDataSource:self]; [_collectionView setDelegate:self];

Any idea what's wrong?

eoghain commented 10 years ago

Without seeing code, I have no idea. However, since you've asked some follow up questions based on things working I guess you figured it out, so I'm going to close this.

shrishaster commented 10 years ago

Yeah I figured it out just yesterday. Thank you for your help.