0
你好,我想添加自定義單元格的分隔符爲我UITableView
所以在我cllforRowAtIndex
委託UITableViewCell中添加自定義視圖加載問題
if (cell == nil) {
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:simpleTableIdentifier]
}
在此之後,我添加自定義UIView
我cell.content觀點
UIView *lineView = [[UIView alloc] initWithFrame:CGRectMake(0, cell.contentView.frame.size.height - 1.0, cell.contentView.frame.size.width, 1)];
lineView.backgroundColor = [UIColor colorWithRed:61.0/255 green:80.0/255 blue:118.0/255 alpha:1.0];
[cell.contentView addSubview:lineView];
但我的問題是,當它第一次加載我的分隔符右側不會去UITableView
edg,但是一旦我滾動表,它就會變成全寬。這是爲什麼?我該如何解決這個問題?
或不能改變默認的分色器顏色? – user1960169
你可以,很容易'[self.tableView setSeparatorColor:[UIColor myColor]];' – RaffAl
謝謝改變顏色解決了我的問題 – user1960169