I have a UIView in my .xib file. (note that not a UIControlView)
@interface OfferUIView : UIView
So the custom class for my UIView is OfferUIView
I want to add a scrollView to it. when I add it using xcode features, I just connect the delegate of scrollview to OfferUIView. How can I do it programmatically in OfferUIView.m?
This is what I dit :
self.scrollView = [[UIScrollView alloc] initWithFrame: frame];
self.scrollView.delegate = self;
But I get a warning on the delegate = self
like this:
Assigning to id<UIScrollViewDelegate> from incompatible type OfferUIView
Do you know how can I fix it?
Edit:
when I use
@interface OfferUIView : UIView <UIScrollViewDelegate>
self.pageViews = [[NSMutableArray alloc] init];
for (NSInteger i = 0; i < pageCount; ++i) {
[self.pageViews addObject:[NSNull null]];
}
CGRect frame = self.view.bounds;
self.scrollView = [[UIScrollView alloc] initWithFrame: frame];
CGSize pagesScrollViewSize = self.view.frame.size;
self.scrollView.contentSize = CGSizeMake(pagesScrollViewSize.width * self.pageImages.count, pagesScrollViewSize.height);
self.scrollView.delegate = self;
It should be couple of images in UIScrollView, but scroll does not work.