2014-06-27 27 views
5

我已經用下面的代碼的tableviewUITableView的不想要的白線在每行分離器

_comboBoxTableView = [[UITableView alloc] initWithFrame:CGRectMake(1, _selectContentLabel.frame.origin.y+_selectContentLabel.frame.size.height-1, frame.size.width+1, 48) style:UITableViewStylePlain]; 
_comboBoxTableView.layer.borderColor=[UIColor colorWithRed:226.0/255.0 green:226.0/255.0 blue:226.0/255.0 alpha:1].CGColor; 
_comboBoxTableView.layer.cornerRadius = 10; 
_comboBoxTableView.layer.borderWidth = 1.0f; 
_comboBoxTableView.separatorColor = [UIColor colorWithRed:166.0/255.0 green:166.0/255.0 blue:166.0/255.0 alpha:1]; 
[_comboBoxTableView setSeparatorStyle:UITableViewCellSeparatorStyleSingleLine]; 

enter image description here 有一個不希望的白色每個分離器的左側,如下所示。

這是一個錯誤?我用ios7.1運行它。任何工作?

回答

1

這不是一個錯誤。從iOS 7開始,表格視圖能夠調整分隔符的插入。如果你想要一個邊緣到邊緣分離,消除插圖:在UITableView documentation

if ([_comboBoxTableView respondsToSelector:@selector(separatorInset)]) { // In case running iOS < 7 
    _comboBoxTableView.separatorInset = UIEdgeInsetsZero; 
} 

更多信息。

+1

+1救了我的時間! –

0

爲了防止您沒有時間修復此問題,您可以添加子視圖修補while行。

enter image description here

我知道,這不妥善解決,但工程。

+0

這個答案是臨界值downvote-able –

0

對我來說什麼工作:在Interface Builder中,tableview有一個叫做Separator Inset的東西。它通常在Default(這似乎是15)。

您可以將其切換到自定義,並用0代替15。沒有更多的怪異線條。

enter image description here

enter image description here

相關問題