自定义tableview分割线
2016-05-17 17:52
387 查看
UITableView中将分割线样式改为None
mainTableView.separatorStyle =
UITableViewCellSeparatorStyleNone;
自定义UITableViewCell中复写- (void)drawRect:(CGRect)rect方法
- (void)drawRect:(CGRect)rect
{
CGContextRef context =
UIGraphicsGetCurrentContext();
CGContextSetFillColorWithColor(context, [UIColor
clearColor].CGColor);
CGContextFillRect(context, rect);
//上分割线,
CGContextSetStrokeColorWithColor(context, [UIColor
purpleColor].CGColor);
CGContextStrokeRect(context,
CGRectMake(5, -1, rect.size.width -
10, 1));
//下分割线
CGContextSetStrokeColorWithColor(context, [UIColor
orangeColor].CGColor);
CGContextStrokeRect(context,
CGRectMake(5, rect.size.height, rect.size.width -
10, 1));
}
mainTableView.separatorStyle =
UITableViewCellSeparatorStyleNone;
自定义UITableViewCell中复写- (void)drawRect:(CGRect)rect方法
- (void)drawRect:(CGRect)rect
{
CGContextRef context =
UIGraphicsGetCurrentContext();
CGContextSetFillColorWithColor(context, [UIColor
clearColor].CGColor);
CGContextFillRect(context, rect);
//上分割线,
CGContextSetStrokeColorWithColor(context, [UIColor
purpleColor].CGColor);
CGContextStrokeRect(context,
CGRectMake(5, -1, rect.size.width -
10, 1));
//下分割线
CGContextSetStrokeColorWithColor(context, [UIColor
orangeColor].CGColor);
CGContextStrokeRect(context,
CGRectMake(5, rect.size.height, rect.size.width -
10, 1));
}
相关文章推荐
- kafka+java 伪分布式安装和配置
- Spring 事务注解 错误问题
- C++中如何可以修改const函数内的成员变量的值?
- 编程小练习
- 笔记
- PAT L2-007. 家庭房产 (并查集)
- something about saving socket resource(basing on WebChat:微信红包)
- ListView分页加载
- nyoj 322 117 求逆序数 归并排序
- Linux那些事儿之我是Sysfs(final)后记
- Jquery ajax 跨域访问
- 解决Eclipse建Maven项目module无法转换为2.3
- lua得到一个真随机数字
- HDU 1455 (dfs 强剪枝)
- 脑残的低级错误之静态成员变量
- 脑残的低级错误之静态成员变量
- 利用platform库获取浏览器和操作系统版本
- mysql问题汇总
- JVM调优- jmap(转)
- 使用Java和Scala在IDE中开发DataFrame实战