-
Notifications
You must be signed in to change notification settings - Fork 32
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
Headers not working? #9
Comments
What kind of trouble? |
Hey @vinnyoodles, thanks for the prompt reply. I'm not able to get the following delegate command to be called:
to create the header cell. Below is how I'm setting up the mosaic layout:
|
Is there a stack trace for this error? |
Nope, no error, header cell just never appears from a modified version of the TRCollectionViewController. Thought it was my implementation (probably still is), but I built a sample app with a basic collectionViewController and was able to get working headers to appear. So my thought now is that I'm missing an extra setting or setup element to permit headers with the mosaic tiles? |
What does your code look like for the header cell? |
|
When you built the CollectionView did you use storyboard/xib or just code? Edit:
|
Thanks @Nathan961207. Using Storyboard. I updated the registration call to:
But a header still does not show nor does the following delegate get called:
In Storyboard I've set the header cell background color to Blue, and in code I set it to Red, but neither are taking affect. |
|
Hi, I also bumped to this kind of issue just recently. I tried commenting out this part of the code: Result: The header came out and also I pass to the area where breakpoint is set. |
So when you are not using TRMosaicLayout the header works and when you use TRMosaicLayout it does not work? Could you provide more info about your code? |
Hi, Thanks for the reply. I just did some modification on the sample project. TRCollectionViewController.swift - I added this code
MosaicHeaderView.swift - New file, no content in it though
Main.Storyboard - Added a header view to it, with a reuse identifier of "MosaicHeaderView" |
Check this answer
http://stackoverflow.com/questions/33343973/swift-uicollectionview-custom-header-in-custom-layout-not-showing/33350781#33350781
…On Wed, 22 Feb 2017 at 22:50, Jun ***@***.***> wrote:
Hi,
Thanks for the reply.
I just did some modification on the sample project.
Added a header to it.
TRCollectionViewController.swift - I added this code
override func collectionView(_ collectionView: UICollectionView,
viewForSupplementaryElementOfKind kind: String, at indexPath: IndexPath) ->
UICollectionReusableView {
var reusableView:UICollectionReusableView?
if kind == UICollectionElementKindSectionHeader {
let headerView:MosaicHeaderView = collectionView.dequeueReusableSupplementaryView(ofKind: UICollectionElementKindSectionHeader, withReuseIdentifier: "MosaicHeaderView", for: indexPath) as! MosaicHeaderView
reusableView = headerView
}
return reusableView!
}
MosaicHeaderView.swift - New file, no content in it though
import UIKit
class MosaicHeaderView: UICollectionReusableView {
}
Main.Storyboard - Added a header view to it, with a reuse identifier of
"MosaicHeaderView"
[image: screen shot 2017-02-23 at 5 47 05 am]
<https://cloud.githubusercontent.com/assets/5847140/23234037/c27cefae-f98b-11e6-8f37-8f824b249b7e.png>
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#9 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AOmtnqz06ogF_cMJpxkG33P_MqgaXMi_ks5rfK2ygaJpZM4LF-vV>
.
|
Thank you. Yes, I didn't register my story board header cell. |
Has anyone solved this because I'm experiencing the same behavior. I can't get viewForSupplementaryElementOfKind to be called when I use TRMosaicLayout |
I am having the same problem. |
I'm having the same issue, was using FlowLayout before but after switching to TRMosaicLayout the header disappeared |
did anyone find the fix, I am using customcollectionViewLayout and my header related functions are not executing and I don't know how to fix this |
Anyone else have trouble adding collectionview headers with the Mosaic Layout?
The text was updated successfully, but these errors were encountered: