title: Where does UICollectionView etc calculate content size so that I can permanently increase it?
body: <p>I want to add a view to the bottom of the content view of both a collection view and table view (and hence is applicable to any kind of scroll view) and I also want to be able to scroll down to see this view e.g.:</p>
  
  <pre><code>- (id)initWithCoder:(NSCoder *)aDecoder
  {
      self = [super initWithCoder:aDecoder];
      if (self) {
          // Observe change in content size so can move my view when
          // content size changes (keep it at the bottom)
          [self addObserver:self forKeyPath:@"contentSize"
                    options:(NSKeyValueObservingOptionPrior)
                    context:nil];
          CGRect frame = CGRectMake(0, 0, 200, 30);
          self.loadingView = [[UIView alloc] initWithFrame:frame];
          [self.loadingView setBackgroundColor:[UIColor blackColor]];
          [self addSubview:self.loadingView];
          // Increase height of content view so that can scroll to my view.
          self.contentSize = CGSizeMake(self.contentSize.width, self.contentSize.height+30);
  
      }
      return self;
  }
  </code></pre>
  
  <p>However when, for example, a cell is inserted the contentSize is recalculated and whilst my view is still visible at the bottom of the content size (due to being able to bounce the scroll view) I can no longer scroll to it.</p>
  
  <p>How do I ensure that the content size stays, as in my code, 30 points taller?</p>
  
  <p>An additional question is: </p>
  
  <ul>
  <li>is there any other way to track content size other than observing it?</li>
  </ul>
  
  <p>Thanks in advance.</p>
  
  <hr>
  
  <p>I have tried:</p>
  
  <pre><code>- (void)layoutSubviews
  {
      [super layoutSubviews];
      self.contentSize = CGSizeMake(self.contentSize.width, self.contentSize.height+30);
  }
  </code></pre>
  
  <p>However this causes all sorts of display issues.</p>