title: Set Delegate Programmatically for a UIScrollView in .xib
body: <p>I have a UIView in my .xib file. (note that not a UIControlView)</p>
  
  <pre><code>@interface OfferUIView : UIView
  </code></pre>
  
  <p>So the custom class for my UIView is OfferUIView </p>
  
  <p>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?</p>
  
  <p>This is what I dit :</p>
  
  <pre><code>self.scrollView = [[UIScrollView alloc] initWithFrame: frame];
  self.scrollView.delegate = self; 
  </code></pre>
  
  <p>But I get a warning on the <code>delegate = self</code> like this:</p>
  
  <pre><code>Assigning to id&lt;UIScrollViewDelegate&gt; from incompatible type OfferUIView
  </code></pre>
  
  <p>Do you know how can I fix it?</p>
  
  <p>Edit:</p>
  
  <p>when I use </p>
  
  <pre><code>@interface OfferUIView : UIView &lt;UIScrollViewDelegate&gt;
  
  self.pageViews = [[NSMutableArray alloc] init];
      for (NSInteger i = 0; i &lt; 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;
  </code></pre>
  
  <p>It should be couple of images in UIScrollView, but scroll does not work.</p>