2013-01-15 26 views
0

我有一個UITableView滾動過多,直到UITableView中的項目列表向上滾動,然後大量的空白跟着它。如何鎖定UITable從表格中的項目滾動

如何停止UITableView滾動該額外空間?

希望我描述得很好。

+0

是contentSize是否正確? – pradeepa

+1

你是否返回numberOfRowsForIndexPath中的正確數字 – pradeepa

回答

1

這將解決您的問題

TableView.bounces=NO; 

這將刪除空單元格

TableView.separatorStyle = UITableViewCellSeparatorStyleNone; 
2

我認爲這可能適合你。在桌子上調用reloadData後運行該代碼:

if (table.contentSize.height < table.frame.size.height) 
{ 
    table.scrollEnabled = NO; 
} 
else 
{ 
    table.scrollEnabled = YES; 
} 

這裏,table.frame.size.height是對象的實際大小(你可以看到這個界面生成器)顯示在屏幕上,而table.contentSize.heightthe header高度,the footer ,和height of every cell加在一起。

我在這裏找到:How to disable scrolling in UITableView table when the content fits on the screen

希望你可以從他們給出的也是答案的東西。

相關問題