UITableView的UITableViewStyle

1,188 阅读1分钟

typedef NS_ENUM(NSInteger, UITableViewStyle) { UITableViewStylePlain, // regular table view UITableViewStyleGrouped, // sections are grouped together UITableViewStyleInsetGrouped API_AVAILABLE(ios(13.0)) API_UNAVAILABLE(tvos) // grouped sections are inset with rounded corners };

在设置为UITableViewStyleGrouped 的时候,sectionHeader sectionFooter是不会跟随滚动而悬停的。 在设置为UITableViewStyleGrouped 有一个奇怪的情况是 设置sectionHeader高度之后 必须也要生成一个sectionHeaderView 高度的设置才会生效. 为什么会这样