iphone - UITableView 单元格用虚线分隔

标签 iphone cocoa-touch

我想将分隔符从 UITableView 更改为虚线。我能找到的只是 UITableViewCellSeparatorStyleBlabla...

我可以用别的东西代替吗?我宁愿不使用图像,但如果没有其他方法......

谢谢!

最佳答案

尝试以下解决方案:

self.tableView.separatorColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"Dottedlineimage"]];   

注意:不要忘记在两个解决方案中关闭表格 View 的默认分隔符样式:[ 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];  

非常乐意提供帮助:)

关于iphone - UITableView 单元格用虚线分隔,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10261602/

相关文章:

iphone - Apple 推送通知服务器 - 反馈始终返回零元组

iphone - 自定义 View 中奇怪的抗锯齿

iphone - 如何改变HUD灰色部分的颜色

iphone - iPhone-关于内存使用情况,NSString和NSMutableString之间的区别

objective-c - 使用 CGAffineTransform 的奇怪结果

iphone - 创建点击叠加说明 View

ios - iCarouselTypeRotary iOS 滚动问题

ios - 在 iOS 7 中将我的应用程序中的状态栏文本颜色永久更改为白色

iphone - 在 iphone 中选择轻按手势上的图像

ios - 如何让 UILabel 显示轮廓文本?