2011-11-23 30 views
1

我想實現一個沒有節標題的分組和索引的UITableView。索引的UITableView沒有節標題

我正在使用sectionIndexTitlesForTableView:(UITableView *)tableView來返回我的標題。

我還實施tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section並返回nil以及tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section並返回0.0f

兩者都不會刪除節標題。不同部分之間仍有空間。

+0

所以你希望桌子看起來好像你只有一個部分? – phi

+0

基本上這就是我想要的,是的。 – dlinsin

+0

在這裏看到我的答案。它應該解決你的問題。 http://stackoverflow.com/questions/2817308/reducing-the-space-between-sections-of-the-uitableview/2817696#2817696將值設置爲1。 – Tomen

回答

0

我有同樣的問題,找不到解決方案。最後,我必須繼承UIViewController(不是UITableViewController),並使用具有透明背景的UITableView,樣式設置爲UITableViewStylePlain。然後,我爲第一行和最後一行(具有圓角)創建了自定義單元格,併爲左側和右側創建了一些透明邊距。如果你願意,我可以給你更多的細節,但因爲它不能直接回答你的問題,我現在只會分享this link