UITableView用虚线分隔的单元格 [英] UITableView Cells separated by dotted lines
本文介绍了UITableView用虚线分隔的单元格的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想将分隔符从UITableView更改为虚线。我可以找到的是
UITableViewCellSeparatorStyleBlabla ...
I'd like to change the separator from a UITableView to a dotted line. All I could find is UITableViewCellSeparatorStyleBlabla...
我可以换一些东西吗?我不想使用图片,但如果没有其他方法...
Can I put something else instead? I'd rather not use images, but if there is no other way...
谢谢!
推荐答案
尝试以下解决方案:
self.tableView.separatorColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"Dottedlineimage"]];
请注意:不要忘记关闭默认分隔符样式
note:Don't forget to turn off the default separator style for the table view in both the solutions: [self.tableView setSeparatorStyle:UITableViewCellSeparatorStyleNone];
=====================或试试这个=================== ========================
=====================OR TRY THIS===========================================
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帮助:)
这篇关于UITableView用虚线分隔的单元格的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文