Good morning,
I am creating a subclass of UIScrollView and now I want to know when the user scrolls my subclass. For this, I implemented it as follows:
ImageScroller.h
@interface UIImageScroller : UIScrollView <UIScrollViewDelegate> {
ImageScroller.m (as part of @implementation)
- (void)scrollViewDidScroll:(UIScrollView *)scrollView { NSLog(@"did scroll"); }
The problem is that the scrollViewDidScroll method does not seem to work. Is there any way to make it work?
I also tried to set a delegate for it, but it does not work.
- (id)initWithCoder:(NSCoder *)aDecoder { if ((self = [super initWithCoder:aDecoder])) { self.directionalLockEnabled = YES; [self setDelegate:self]; } return self; }
I added a ScrollView to my XIB file and set the class if it was on my ImageScroller. I also installed Fileowner, and I use UIScrollViewDelegate in the .h file of the ViewController, and also implement the scrollViewDidScroll method in the .m file.
When I set the delegate of my ImageScroller to the code of the .m file from the XIB, like [imageScroller setDelegate: imageScroller] scrollViewDidScroll runs in my ImageScroller subclass, but the one in my ViewController does not start, but I need both.
Any solutions for this?
Thanks for your answers in advance.
source share