I can't find the way to add my custom data source class of UICollectionView in the storyboard. The data source class has an interface like this:
@interface CalendarDataSource : NSObject<UICollectionViewDataSource>
I try to find the calendar data source in the scene sidebar but I can't. So I can't seem to link the class to my UICollectionView. Is there something I should do but I didn't?
If you want to reproduce the similar problem, just create a new project in XCode5, set up a UICollectionViewController, and create a new class just like above.
I'm currently rewriting the project described in http://www.objc.io/issue-3/ The Github repo is https://github.com/objcio/issue-3-collection-view-layouts This project managed to do this, however. My code is almost the same to the project but can't run because viewcontroller.collectionView.dataSource is uninitialized.
Doing the initialisation programmatically is another issue, but please tell me in the comment because all I got from the internet is setting dataSource to self. But setting it to self doesn't require introducing a new retained data source object, which I got stuck on.
Go to the Interface Builder.
dataSource
outlet (if any).CalendarDataSource
instead of pre-defined NSObject
. In left side panel ('Scenes'), 'Object' will be renamed to 'Calendar Data Source' automatically.dataSource
outlet.You've done!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With