Set UIScrollView delegate to it's own custom class
I created a custom component from UIScrollView.
I create a custom UIScrollview class and add it to my scroll view.
And in the custom class in "- (void)drawRect:(CGRect)rect" I design my scroll view the way I wanted. and its all working fine.
My Question is how to add my scrollview as the delegate of the Custom class.
I did this inside my custom class -
self.delegate = self;
and the delegate get set and I have access to the UIScroll view delegate methods (like - - (void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView).
My problem is once I set my delegate like 'self.delegate = self;' compiler gives me a warning like below
Please can anyone help me to fix this warning.
You need to declare your custom class as conforming to the UIScrollViewDelegate protocol.
Check out the Apple docs on protocols.
In your header file, you probably have something like
@interface OGOTimeSelector : UIScrollView
To declare that your class conforms to the UIScrollViewDelegate protocol, this would become:
@interface OGOTimeSelector : UIScrollView <UIScrollViewDelegate>