Open Obbut opened 10 years ago
Slightly off topic, but I thought I'd mention something here: there may be times where it's desirable to set the UIScrollViewDelegate and the TimelineViewDelegate separately (such as for synchronizing scrolling between timeline views). Perhaps splitting up the delegate would work as well?
The protocol definition of TimelineViewDelegate currently looks like this:
Because TimelineView inherits from UIScrollView, and UIScrollView already has a property 'delegate', you require every class that is a TimelineViewDelegate to also explicitly be a UIScrollViewDelegate:
However, if you would let the TimelineViewDelegate protocol inherit from UIScrollViewDelegate, you could overcome this 'issue', and thus requiring less unneccessary code.
If we change the protocol definition to this:
And make this change in TimelineView.h:
In your sample code, the delegate and dataSource are set via interface builder, which is why no warning is given when compiling the sample project -- even though ViewController does not conform to the UIScrollViewDelegate protocol. When setting the data source and/or the delegate programmatically, however, a compile warning is given.