2013-09-23 52 views
0

有沒有簡單的方法從-[UITableViewCell initWithStyle:reuseIdentifier:]以內的UITableViewseparatorColor從UITableViewCell獲取UITableView separatorColor?

我這麼問是因爲我使用-[UITableView dequeueReusableCellWithIdentifier:forIndexPath:]並要垂直分隔添加到UITableViewCell是相同的顏色,因爲它是tableViewseparatorColor

回答

1

我不認爲有。

雖然,有-[UITableViewCell separatorInsets]

我會推薦硬編碼tableView.separatorColor與任何你想要的UIColor和使用相同的UIColor-[UITableViewCell initWithStyle:reuseIdentifier:]

3

由於分隔視圖由UITableView管理,因此UIKit不會將顏色暴露給UITableViewCells。但是,分隔符插頁可以由單元格配置,因爲只有單元格應該具有關於其佈局的知識,這可能會更改所需的插頁。

我建議傳遞的顏色配置你的時候,無論是在-[UITableView tableView:willDisplayCell:forRowAtIndexPath:]-[UITableView tableView:cellForRowAtIndexPath:]

相關問題