I've got this code from this post and everything is ok except one thing, I have this error that I dont know how to fix. this is the code:
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event{
CGPoint touchPoint = [[[event touchesForView:self] anyObject] locationInView:self];
CGRect currentBounds = self.bounds;
CGFloat x = touchPoint.x - CGRectGetMidX(currentBounds);
if(x<0 && self.currentPage>=0){
self.currentPage--;
[self.delegate pageControlPageDidChange:self];
}
else if(x>0 && self.currentPage<self.numberOfPages-1){
self.currentPage++;
[self.delegate pageControlPageDidChange:self];
}
}
the error is that:
No visible @interface for 'NSObject<PageControlDelegate>' declares the selector 'pageControlPageDidChange:'.
I've tried to run this code with ARC, I removed the dealloc method, changed assign to weak in here:
@property (nonatomic, weak) NSObject<PageControlDelegate> *delegate;
as someone wrote in the answers, but still it isn't working.
Please help me.