それでも問題が解決しない場合は、scrollViewを必要とせずにこれを試してください。
DBDの例をしばらく試してみたところ、frameとcontentSizeを次のように一緒に設定できないようです。
self.tableView.contentSize = CGSizeMake(320, scrollHeight);
self.tableView.frame = CGRectMake(self.tableView.frame.origin.x,44,self.tableView.contentSize.width,self.tableView.contentSize.height);
フレームの最大高さを設定しようとしましたが、セルの数が多い場合は、すべてのコンテンツをスクロールする機能を維持しました。このハックはうまく機能しているようで、必要に応じてより多くの条件で変更できます。
int cellCount = [YOURARRAY count];
CGFloat scrollHeight = cellCount*44+44;//for a cell with height of 44 and adding 44 if you have a toolbar at the bottom
self.tableView.contentSize = CGSizeMake(320, scrollHeight);//you can change the width and or let the .xib control the autoresizing
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad && cellCount < 14)
{
//here's were you can add more conditions if you're in landscape or portrait, but this handles 14 cells with a heightForHeaderInSection of 46 in landscape
self.tableView.frame = CGRectMake(self.tableView.frame.origin.x,44,self.tableView.contentSize.width,scrollHeight);
}
else if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone && cellCount < 7)
{
//same as above but it's for the iPhone in portrait
self.tableView.frame = CGRectMake(self.tableView.frame.origin.x,44,self.tableView.contentSize.width,scrollHeight);
}
これは確かに機能します。.xib内またはコード内でautoresizingMaskを調整する必要があるかもしれませんが、このハックは、私の場合、すべての異なる変数を処理する唯一の解決策です。