'Subclassing UIScrollview does not trigger delegate methods

Hello everyone i am trying to implement scrollViewDidScroll in a seperate class for a UIScrollview in my ViewController. Does not trigger the method...Any help appreciated.

C8MyProfileScrollView.h

#import <Foundation/Foundation.h>

NS_ASSUME_NONNULL_BEGIN

@interface C8MyProfileScrollView : NSObject <UIScrollViewDelegate>
@property (nonatomic, assign) id<UIScrollViewDelegate> myOwnDelegate;
-(void)scrollViewDidScroll:(UIScrollView *)scrollView;
@end

NS_ASSUME_NONNULL_END

C8MyProfileScrollView.m

#import "C8MyProfileScrollView.h"

    @implementation C8MyProfileScrollView
    
-(id)init{
    self = [super init];

    self.myOwnDelegate = self;
    return self;
}

    
    
    - (void) scrollViewDidScroll:(UIScrollView *)scrollView {
        NSLog(@"scrolling in seperate class");
    }

@end

In my viewcontroller i set it like this

C8MyProfileScrollView *profileTopScrollView = [[C8MyProfileScrollView alloc]initWithFrame:self.scrollView.frame];
self.scrollView.delegate=profileTopScrollView.myOwnDelegate;


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source