1.同分区第一行cell 和最后一行cell 会切圆角,10, 改不了半径
UITableViewStyleInsetGrouped if (@available(iOS 13.0, *)) { _tableView = [[UITableView alloc] initWithFrame:CGRectMake(0, 0, 0, 0) style:UITableViewStyleInsetGrouped]; } else { _tableView = [[UITableView alloc] initWithFrame:CGRectMake(0, 0, 0, 0) style:UITableViewStyleGrouped]; }
2.cell 指定切圆角
#import <UIKit/UIKit.h> NS_ASSUME_NONNULL_BEGIN @interface UIView (PersonCategory) - (void)addRoundedCorners:(UIRectCorner)corners frame:(CGRect)frame cornerRadius:(CGFloat)cornerRadius; @end NS_ASSUME_NONNULL_END
#import "UIView+PersonCategory.h" @implementation UIView (PersonCategory) /// 部分圆角 - (void)addRoundedCorners:(UIRectCorner)corners frame:(CGRect)frame cornerRadius:(CGFloat)cornerRadius { UIBezierPath *maskPath = [UIBezierPath bezierPathWithRoundedRect:frame byRoundingCorners:corners cornerRadii:CGSizeMake(cornerRadius, cornerRadius)]; CAShapeLayer *maskLayer = [CAShapeLayer layer]; maskLayer.frame = frame; maskLayer.path = maskPath.CGPath; self.layer.mask = maskLayer; } @end
/// 设置cell圆角 - (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath{ if (self.dataArray.count > 0 && (indexPath.row == self.dataArray.count - 1)) { [cell addRoundedCorners:UIRectCornerBottomLeft | UIRectCornerBottomRight frame:cell.bounds cornerRadius:10]; } }
参考:
「iOS」UITableView.Style.insetGrouped样式 及 代码实现圆角cell 方案
https://zhuanlan.zhihu.com/p/354622408
ios swift tableView insetGrouped 圆角 组间距
https://blog.csdn.net/baidu_40537062/article/details/129702088
iOS 多个分区的tableView设置每个分区第一行和最后一行圆角效果
https://www.jianshu.com/p/650831d6ce6d
iOS 设置tableView每个分区cell圆角
https://www.jianshu.com/p/abd7738e146b
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 阿里最新开源QwQ-32B,效果媲美deepseek-r1满血版,部署成本又又又降低了!
· 开源Multi-agent AI智能体框架aevatar.ai,欢迎大家贡献代码
· Manus重磅发布:全球首款通用AI代理技术深度解析与实战指南
· 被坑几百块钱后,我竟然真的恢复了删除的微信聊天记录!
· 没有Manus邀请码?试试免邀请码的MGX或者开源的OpenManus吧
2018-09-21 swift和OC - 拆分数组 和 拆分字符串