Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding footer #21

Closed
krisanthony opened this issue Mar 29, 2017 · 6 comments
Closed

Adding footer #21

krisanthony opened this issue Mar 29, 2017 · 6 comments

Comments

@krisanthony
Copy link

Hey having an issue using the FlowDelegate method to add a footer to the collection view. It is not being called. I'm not seeing any obvious reason it wouldn't be called looking through your code, perhaps I'm missing something here. Could you shed some light on this?

Using the method (UICollectionReusableView *)collectionView:(UICollectionView *)theCollectionView viewForSupplementaryElementOfKind:(NSString *)kind atIndexPath:(NSIndexPath *)theIndexPath (in swift) as well as registering a nib for use in viewDidLoad. This works in other view controllers, just not in a subclass of NOCChatViewController

@little2s
Copy link
Owner

@krisanthony Because I custom the layout of collectionView in NOCChatViewController, there is only one section, I did not add supplementary view or decoration view support. If you want to use supplementary view for some reason, you can custom NOCChatCollectionViewLayout by yourself. I recommend you use cell just without event handler in NOCChatViewController.

@krisanthony
Copy link
Author

krisanthony commented Mar 30, 2017 via email

@krisanthony
Copy link
Author

In the same vein is it possible to adjust the content inset at all? Seems to be constantly being adjusted. I need some padding on the top, the list is in reversed mode. How would I go about adding some padding to the top of the messages?

@little2s
Copy link
Owner

little2s commented Apr 1, 2017

@krisanthony You're welcome. Could you show me how did implement custom layout? Maybe I can help you find out the reason. About the content inset, in reversed mode, you can modify the bottom inset, but you need to be careful, when the size of chat view changed or keyboard frame changed, you should consider your changes.

@krisanthony
Copy link
Author

krisanthony commented Apr 30, 2017

Nothing special. I tried two ways. One, I made the NOCChatViewController subclass conform to UICollectionViewDelegateFlowLayout, and placed the necessary code (register reuse in viewDidLoad, conform to the viewForSupplementary and footerSize methods) directly into that view controller. The methods were never called.

Then I also tried using a custom flow layout that was a subclass of NOCChatCollectionViewLayout, and set that to the NOCChatViewController subclass's collectionView flow delegate. I verified it was being set correctly, but the necessary supplementary view methods were still not called.

I have used the same exact code in the same project in a non-NOC view controller and it all works as expected. Are you perhaps capturing the delegate calls and not forwarding them for some reason?

@little2s
Copy link
Owner

little2s commented May 3, 2017

@krisanthony NOCChatCollectionViewLayout is not a subclass of UICollectionViewFlowLayout, so the methods of UICollectionViewDelegateFlowLayout won't be called. When you custom NOCChatCollectionViewLayout, you should also custom delegate of it, and call the methods manually.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants