UITableViewCell(QMUI)

@interface UITableViewCell (QMUI)

/// 获取当前 cell 所在的 tableView,iOS 13 下在 init 时就可以获取到值,而 iOS 12 及以下只能在 cell 被塞给 tableView 后才能获取到值
@property(nonatomic, weak, readonly, nullable) UITableView *qmui_tableView;

/// 设置 cell 点击时的背景色,如果没有 selectedBackgroundView 会创建一个。
/// @warning 请勿再使用 self.selectedBackgroundView.backgroundColor 修改,因为 QMUITheme 里会重新应用 qmui_selectedBackgroundColor,会覆盖 self.selectedBackgroundView.backgroundColor 的效果。
@property(nonatomic, strong, nullable) UIColor *qmui_selectedBackgroundColor;

/// setHighlighted:animated: 方法的回调 block
@property(nonatomic, copy, nullable) void (^qmui_setHighlightedBlock)(BOOL highlighted, BOOL animated);

/// setSelected:animated: 方法的回调 block
@property(nonatomic, copy, nullable) void (^qmui_setSelectedBlock)(BOOL selected, BOOL animated);

/// 获取当前 cell 的 accessoryView,优先级分别是:编辑状态下的 editingAccessoryView -> 编辑状态下的系统自己的 accessoryView -> 普通状态下的自定义 accessoryView -> 普通状态下系统自己的 accessoryView
@property(nonatomic, strong, readonly, nullable) __kindof UIView *qmui_accessoryView;

@end

Undocumented

  • 获取当前 cell 所在的 tableView,iOS 13 下在 init 时就可以获取到值,而 iOS 12 及以下只能在 cell 被塞给 tableView 后才能获取到值

    Declaration

    Objective-C

    @property (nonatomic, weak, readonly, nullable) UITableView *qmui_tableView;

    Swift

    weak var qmui_tableView: UITableView? { get }
  • 设置 cell 点击时的背景色,如果没有 selectedBackgroundView 会创建一个。

    Warning

    请勿再使用 self.selectedBackgroundView.backgroundColor 修改,因为 QMUITheme 里会重新应用 qmui_selectedBackgroundColor,会覆盖 self.selectedBackgroundView.backgroundColor 的效果。

    Declaration

    Objective-C

    @property (nonatomic, strong, nullable) UIColor *qmui_selectedBackgroundColor;

    Swift

    var qmui_selectedBackgroundColor: UIColor? { get set }
  • setHighlighted:animated: 方法的回调 block

    Declaration

    Objective-C

    @property (nonatomic, copy, nullable) void (^)(BOOL, BOOL) qmui_setHighlightedBlock;

    Swift

    var qmui_setHighlightedBlock: ((Bool, Bool) -> Void)? { get set }
  • setSelected:animated: 方法的回调 block

    Declaration

    Objective-C

    @property (nonatomic, copy, nullable) void (^)(BOOL, BOOL) qmui_setSelectedBlock;

    Swift

    var qmui_setSelectedBlock: ((Bool, Bool) -> Void)? { get set }
  • 获取当前 cell 的 accessoryView,优先级分别是:编辑状态下的 editingAccessoryView -> 编辑状态下的系统自己的 accessoryView -> 普通状态下的自定义 accessoryView -> 普通状态下系统自己的 accessoryView

    Declaration

    Objective-C

    @property (nonatomic, strong, readonly, nullable) __kindof UIView *qmui_accessoryView;

    Swift

    var qmui_accessoryView: UIView? { get }