title: UICollectionViewDataSource, UICollectionViewDelegate in UIView
body: <p>I have created a <code>UIView</code> with <code>UICollectionView</code>. </p>
  
  <p>In the interface declaration of the <code>UIView</code> I have conformed to the <code>UICollectionViewDataSource</code>, <code>UICollectionViewDelegate</code> protocols:</p>
  
  <pre><code> @interface TestOverview : UIView &lt;UICollectionViewDataSource, UICollectionViewDelegate&gt;
  </code></pre>
  
  <p>But when I run the app, it crashes and i get this error:-</p>
  
  <pre><code>error: -[TestScreenViewController collectionView:numberOfItemsInSection:]: unrecognized selector sent to instance.
  </code></pre>
  
  <ul>
  <li>Just to be clear the method <code>collectionView:numberOfItemsInSection</code> is in the <code>UIView</code> (TestOverview), which was declared to be the delegate of the <code>UICollectionView</code>. So why does it expect to recieve it in the <code>UIViewController</code>(TestScreenViewController), which contains the <code>UIView</code> that contains the <code>UICollectionView</code>? </li>
  </ul>