// 设置分割线的样式为None. self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
typedef NS_ENUM(NSInteger, UITableViewCellSeparatorStyle) {
UITableViewCellSeparatorStyleNone, //不显示分割线
UITableViewCellSeparatorStyleSingleLine,// 单线
UITableViewCellSeparatorStyleSingleLineEtched
// 这种分离式仅支持分组样式表视图
// This separator style is only supported for grouped style table views currently
}
- (void)setFrame:(CGRect)frame {
frame.origin.y += 1; // 让cell的y值增加1(根据自己需要分割线的高度来进行调整)
frame.size.height -= 1; // 让cell的高度减1
[super setFrame:frame]; // 别忘了重写父类方法
}
if ([self.tableView respondsToSelector:@selector(setSeparatorInset:)]) {
// 如果tableView响应了setSeparatorInset: 这个方法,我们就将tableView分割线的内边距设为0.
[self.tableView setSeparatorInset:UIEdgeInsetsZero];
}
if ([self.tableView respondsToSelector:@selector(setLayoutMargins:)]) {
// 如果tableView响应了setLayoutMargins: 这个方法,我们就将tableView分割线的间距距设为0.
[self.tableView setLayoutMargins:UIEdgeInsetsZero];
}
- (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath {
// 这两句的含义跟上面两句代码相同,就不做解释了
if ([cell respondsToSelector:@selector(setSeparatorInset:)]) {
[cell setSeparatorInset:UIEdgeInsetsZero];
}
if ([cell respondsToSelector:@selector(setLayoutMargins:)]) {
[cell setLayoutMargins:UIEdgeInsetsZero];
}
}
机械节能产品生产企业官网模板...
大气智能家居家具装修装饰类企业通用网站模板...
礼品公司网站模板
宽屏简约大气婚纱摄影影楼模板...
蓝白WAP手机综合医院类整站源码(独立后台)...苏ICP备2024110244号-2 苏公网安备32050702011978号 增值电信业务经营许可证编号:苏B2-20251499 | Copyright 2018 - 2025 源码网商城 (www.ymwmall.com) 版权所有