iOS开发:iOS TableViewCell自定义分割线
2015-10-15 14:23
411 查看
实现如下:
UITableView中将分割线样式改为None
自定义UITableViewCell中复写- (void)drawRect:(CGRect)rect方法
UITableView中将分割线样式改为None
tableView.separatorStyle = UITableViewCellSeparator<wbr>StyleNone;</wbr>
自定义UITableViewCell中复写- (void)drawRect:(CGRect)rect方法
- (void)drawRect:(CGRect)rect { CGContextRef context = UIGraphicsGetCurrentCont<wbr>ext(); CGContextSetFillColorWit<wbr>hColor(context, [UIColor clearColor].CGColor); CGContextFillRect(context, rect); //上分割线, CGContextSetStrokeColorW<wbr>ithColor(context, [UIColor colorWithHexString:@"ffffff"].CGColor); CGContextStrokeRect(context, CGRectMake(5, -1, rect.size.width - 10, 1)); //下分割线 CGContextSetStrokeColorW<wbr>ithColor(context, [UIColor colorWithHexString:@"e2e2e2"].CGColor); CGContextStrokeRect(context, CGRectMake(5, rect.size.height, rect.size.width - 10, 1)); }</wbr></wbr></wbr></wbr>
相关文章推荐
- iOS CocoaPods使用
- iOS 怕忘记的一些备用代码
- iOS 重写isEqual方法
- iOS应用性能调优(二)
- iOS程序性能优化(一)
- 如何减小iOS应用程序的大小?
- iOS原生地图开发进阶——使用导航和附近兴趣点检索
- ios之TableViewCell重用机制避免重复显示问题
- IOS Table中Cell的重用reuse机制分析
- iOS-方形图片设置成圆形图片
- iOS:CALayer锚点的使用
- Nagios 客户端简单安装
- iOS通过dSYM文件分析crash
- iOS exit函数深入浅出
- Nagios 服务端简单安装
- iOS开发如何将自己的程序在真机上运行
- iOS: 解决某些第三方库因为ARC不能使用的问题
- iOS 8 AutoLayout与Size Class自悟
- ios如何在xcode中创建文件夹
- 字符串