Constants

The following constants are available globally.

  • 当某个 UIView 在 setFrame: 时高度传这个值,则会自动将 sizeThatFits 算出的高度设置为当前 view 的高度,相当于以下这段代码的简化:

    // 以前这么写
    CGSize size = [view sizeThatFits:CGSizeMake(width, CGFLOAT_MAX)];
    view.frame = CGRectMake(x, y, width, size.height);
    
    // 现在可以这么写:
    view.frame = CGRectMake(x, y, width, QMUIViewSelfSizingHeight);
    

    Declaration

    Objective-C

    extern const CGFloat QMUIViewSelfSizingHeight

    Swift

    let QMUIViewSelfSizingHeight: CGFloat
  • 将原本的 dynamic color 绑定到 CGColorRef 上的 key

    Declaration

    Objective-C

    extern NSString *const _Nonnull QMUICGColorOriginalColorBindKey

    Swift

    let QMUICGColorOriginalColorBindKey: String
  • Undocumented

    Declaration

    Objective-C

    extern const CGFloat QMUILineHeightIdentity

    Swift

    let QMUILineHeightIdentity: CGFloat
  • iOS 13 下当 UIUserInterfaceStyle 发生变化前的通知,可用于更新状态,例如 QMUIThemeManager 利用其来自动切换主题

    Declaration

    Objective-C

    extern API_AVAILABLE(ios(13.0)) const NSNotificationName
        QMUIUserInterfaceStyleWillChangeNotification

    Swift

    static let QMUIUserInterfaceStyleWillChange: NSNotification.Name