UITableView使用记录

swift

public enum Style : Int, @unchecked Sendable {

    case plain = 0 // 通用类

    case grouped = 1 // 分组模式

    @available(iOS 13.0, *)
    case insetGrouped = 2 // iOS13以后支持的API,给组加圆角,效果如下
}
insetGrouped
insetGrouped

swift

if #available(iOS 15.0, *) {
    tableView.sectionHeaderTopPadding = 0
}

objc

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

swift

func tableView(_ tableView: UITableView, heightForFooterInSection section: Int) -> CGFloat {
    return 0
}
    
func tableView(_ tableView: UITableView, viewForFooterInSection section: Int) -> UIView? {
    return UIView()
}

objc

[UIView setAnimationsEnabled:false];
        [CATransaction begin];
        [CATransaction setCompletionBlock:^{
            [UIView setAnimationsEnabled:true];
        }];
        [self.tableView beginUpdates];
        [self.tableView insertRowsAtIndexPaths:addIndexPathes
                              withRowAnimation:UITableViewRowAnimationNone];
        [self.tableView endUpdates];
        [CATransaction commit];

相关内容