2016-06-28 78 views
-3

我正在努力去除UITableView中每個自定義節標題下方的白線,如下所示。有什麼建議麼?我已經在我的TableView中使用了它。刪除UITableView中的部分標題下的白線?

self.tableView.separatorStyle = UITableViewCellSeparatorStyle.None 

上面只解決了單元格之間的分隔符,而不是標題。

我有我的自定義節頭的唯一事情是

containerCellView.backgroundColor = UIColor(red: 24/255.0, green: 34/255.0, blue: 41/255.0, alpha: 100) 

enter image description here

+0

請出示你的代碼頭 – AnthoPak

+0

參考http://stackoverflow.com/questions/925115/is-there-a-way-to-remove-分隔線從一個可用視圖 – Signare

+0

您是否使用UITableViewCell作爲標題?您在編輯中提供的代碼不負責顯示標題。 – AnthoPak

回答

0

使用此代碼是你設置你的頭

headerView.layer.borderColor=[UIColor blackColor].CGColor;   
headerView.layer.borderWidth=1.0f; 
+0

你已經設置了[UIColor blackcolor]; – Birendra

+0

不起作用,因爲我猜它並不是真正的分隔符。 – Recusiwe

1

設置heigth的頭&頁腳0.01它會解決你的問題

func tableView(tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat { 

      return 0.01 

    } 
+0

我使用我的標題,所以我最好不要設置高度? – Recusiwe

+0

這解決了我的問題!謝謝! –

0

in viewDidLoad,add this line:

self.tableView.separatorColor = [UIColor clearColor];

+0

不適用於我。 – Recusiwe

+0

給我一分鐘,我會測試它,讓你知道 – Muthukumar

0

我發現它是我的標題單元格的backgroundColor導致了問題。

self.backgroundColor = UIColor.blackColor() 

問題解決了在自定義頭類