swift - iOS 15以后设置 tableview 的 s

2023-02-27  本文已影响0人  Matsonga

如图所示:


多出大约20像素
swift
        if #available(iOS 15.0, *) {
            tableView?.sectionHeaderTopPadding = 0
        }

        if #available(iOS 15.0, *) {
            UITableView.appearance().sectionHeaderTopPadding = 0
        }
Object - c

        if (@available(iOS 15.0, *)) {
            _tableView.sectionHeaderTopPadding = 0;
        }

        if (@available(iOS 15.0, *)) {
            [UITableView appearance].sectionHeaderTopPadding = 0;
        }

修改后


修改后
# 在 iOS15 中 UITableView 新增属性和方法:
 
@property (nonatomic, getter=isPrefetchingEnabled) BOOL prefetchingEnabled
 
@property (nonatomic) CGFloat fillerRowHeight
 
@property (nonatomic) CGFloat sectionHeaderTopPadding
 
@property (nonatomic) BOOL allowsFocus
 
@property (nonatomic) BOOL allowsFocusDuringEditing
 
- (void)reconfigureRowsAtIndexPaths:(NSArray<NSIndexPath *> *)indexPaths 
 
- (BOOL)tableView:(UITableView *)tableView selectionFollowsFocusForRowAtIndexPath:(NSIndexPath *)indexPath

上一篇 下一篇

猜你喜欢

热点阅读