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

Setting custom classes for cells has no effect #7

Open
ened opened this issue Sep 29, 2013 · 1 comment
Open

Setting custom classes for cells has no effect #7

ened opened this issue Sep 29, 2013 · 1 comment

Comments

@ened
Copy link

ened commented Sep 29, 2013

Given my code looks like this:

self.mnCalendarView.dayCellClass = [CAMNCalendarViewCell class];

And when this mnCalendarView property is assigned through IB, then the dayCellClass property setting has no effect, because internally, the collection view has the classes already registered. I fixed this by adding an additional setter within MNCalendarView as follows:

- (void)setDayCellClass:(Class)dayCellClass {
    _dayCellClass = dayCellClass;

    [_collectionView registerClass:self.dayCellClass
        forCellWithReuseIdentifier:MNCalendarViewDayCellIdentifier];
}

This simply overwrites the current cell class setting for the collection view.

Still thinking of a better way, but perhaps I will go ahead and submit a PR (for this and the other 2 getters)? Happy to get opinions on this.

@kooliokey
Copy link

I ran into this issue as well, however I searched the code and saw it was all being registered in the method registerUICollectionViewClasses(), so I just called that method myself after I set my custom class. Not sure what the advantages/disadvantages are to either approach. Mine is one less method, but yours is straight forward.

Key

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