我想將分隔符從UITableView更改爲虛線。所有我能找到的是 UITableViewCellSeparatorStyleBlabla ...由虛線分隔的UITableView單元格
我可以放點別的嗎?我寧願不使用圖像,但如果沒有其他方式...
謝謝!
我想將分隔符從UITableView更改爲虛線。所有我能找到的是 UITableViewCellSeparatorStyleBlabla ...由虛線分隔的UITableView單元格
我可以放點別的嗎?我寧願不使用圖像,但如果沒有其他方式...
謝謝!
嘗試以下解決方案:
self.tableView.separatorColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"Dottedlineimage"]];
注:不要忘記關閉默認的分隔樣式表視圖中兩種解決方案:[self.tableView setSeparatorStyle:UITableViewCellSeparatorStyleNone];
= ====================或試試這個=========================== ================
UIImageView *aLine = [[UIImageView alloc] initWithFrame:CGRectMake(cell.frame.origin.x, cell.frame.origin.y, cell.frame.size.width, cell.frame.size.height)];
[aLine setImage:[UIImage imageNamed:@"yourDottedImage.png"]];
[cell.contentView addSubview:aLine];
[aLine release];
^h APPY幫助:)
我更喜歡使用第一個,因爲如果使用複選標記,contentView將放置它並縮小到左側。 – tounaobun 2016-01-18 06:49:23
我認爲沒有分隔符作爲虛線。 您可以通過將圖像附加到自定義單元格的末尾來創建自己的分隔符。
創建標籤與文本@「 - 」或@「...」,並填寫你想要的文字顏色的屏幕。 – 2013-06-05 06:04:15