UIView(QMUI)
@interface UIView (QMUI)
/**
相当于 initWithFrame:CGRectMake(0, 0, size.width, size.height)
@param size 初始化时的 size
@return 初始化得到的实例
*/
- (instancetype)qmui_initWithSize:(CGSize)size;
/**
将要设置的 frame 用 CGRectApplyAffineTransformWithAnchorPoint 处理后再设置
*/
@property(nonatomic, assign) CGRect qmui_frameApplyTransform;
/**
在 iOS 11 及之后的版本,此属性将返回系统已有的 self.safeAreaInsets。在之前的版本此属性返回 UIEdgeInsetsZero
*/
@property(nonatomic, assign, readonly) UIEdgeInsets qmui_safeAreaInsets;
/**
有修改过 tintColor,则不会再受 superview.tintColor 的影响
*/
@property(nonatomic, assign, readonly) BOOL qmui_tintColorCustomized;
/**
移除当前所有 subviews
*/
- (void)qmui_removeAllSubviews;
/// 同 [UIView convertPoint:toView:],但支持在分属两个不同 window 的 view 之间进行坐标转换,也支持参数 view 直接传一个 window。
- (CGPoint)qmui_convertPoint:(CGPoint)point toView:(nullable UIView *)view;
/// 同 [UIView convertPoint:fromView:],但支持在分属两个不同 window 的 view 之间进行坐标转换,也支持参数 view 直接传一个 window。
- (CGPoint)qmui_convertPoint:(CGPoint)point fromView:(nullable UIView *)view;
/// 同 [UIView convertRect:toView:],但支持在分属两个不同 window 的 view 之间进行坐标转换,也支持参数 view 直接传一个 window。
- (CGRect)qmui_convertRect:(CGRect)rect toView:(nullable UIView *)view;
/// 同 [UIView convertRect:fromView:],但支持在分属两个不同 window 的 view 之间进行坐标转换,也支持参数 view 直接传一个 window。
- (CGRect)qmui_convertRect:(CGRect)rect fromView:(nullable UIView *)view;
+ (void)qmui_animateWithAnimated:(BOOL)animated duration:(NSTimeInterval)duration delay:(NSTimeInterval)delay options:(UIViewAnimationOptions)options animations:(void (^)(void))animations completion:(void (^ __nullable)(BOOL finished))completion;
+ (void)qmui_animateWithAnimated:(BOOL)animated duration:(NSTimeInterval)duration animations:(void (^ __nullable)(void))animations completion:(void (^ __nullable)(BOOL finished))completion;
+ (void)qmui_animateWithAnimated:(BOOL)animated duration:(NSTimeInterval)duration animations:(void (^ __nullable)(void))animations;
+ (void)qmui_animateWithAnimated:(BOOL)animated duration:(NSTimeInterval)duration delay:(NSTimeInterval)delay usingSpringWithDamping:(CGFloat)dampingRatio initialSpringVelocity:(CGFloat)velocity options:(UIViewAnimationOptions)options animations:(void (^)(void))animations completion:(void (^)(BOOL finished))completion;
@end
Undocumented
-
相当于 initWithFrame:CGRectMake(0, 0, size.width, size.height)
Declaration
Objective-C
- (nonnull instancetype)qmui_initWithSize:(CGSize)size;
Swift
func qmui_init(with size: CGSize) -> Self
Parameters
size
初始化时的 size
Return Value
初始化得到的实例
-
将要设置的 frame 用 CGRectApplyAffineTransformWithAnchorPoint 处理后再设置
Declaration
Objective-C
@property (nonatomic) CGRect qmui_frameApplyTransform;
Swift
var qmui_frameApplyTransform: CGRect { get set }
-
在 iOS 11 及之后的版本,此属性将返回系统已有的 self.safeAreaInsets。在之前的版本此属性返回 UIEdgeInsetsZero
Declaration
Objective-C
@property (nonatomic, readonly) UIEdgeInsets qmui_safeAreaInsets;
Swift
var qmui_safeAreaInsets: UIEdgeInsets { get }
-
有修改过 tintColor,则不会再受 superview.tintColor 的影响
Declaration
Objective-C
@property (nonatomic, readonly) BOOL qmui_tintColorCustomized;
Swift
var qmui_tintColorCustomized: Bool { get }
-
移除当前所有 subviews
Declaration
Objective-C
- (void)qmui_removeAllSubviews;
Swift
func qmui_removeAllSubviews()
-
同 [UIView convertPoint:toView:],但支持在分属两个不同 window 的 view 之间进行坐标转换,也支持参数 view 直接传一个 window。
Declaration
Objective-C
- (CGPoint)qmui_convertPoint:(CGPoint)point toView:(nullable UIView *)view;
Swift
func qmui_convert(_ point: CGPoint, to view: UIView?) -> CGPoint
-
同 [UIView convertPoint:fromView:],但支持在分属两个不同 window 的 view 之间进行坐标转换,也支持参数 view 直接传一个 window。
Declaration
Objective-C
- (CGPoint)qmui_convertPoint:(CGPoint)point fromView:(nullable UIView *)view;
Swift
func qmui_convert(_ point: CGPoint, from view: UIView?) -> CGPoint
-
同 [UIView convertRect:toView:],但支持在分属两个不同 window 的 view 之间进行坐标转换,也支持参数 view 直接传一个 window。
Declaration
Objective-C
- (CGRect)qmui_convertRect:(CGRect)rect toView:(nullable UIView *)view;
Swift
func qmui_convert(_ rect: CGRect, to view: UIView?) -> CGRect
-
同 [UIView convertRect:fromView:],但支持在分属两个不同 window 的 view 之间进行坐标转换,也支持参数 view 直接传一个 window。
Declaration
Objective-C
- (CGRect)qmui_convertRect:(CGRect)rect fromView:(nullable UIView *)view;
Swift
func qmui_convert(_ rect: CGRect, from view: UIView?) -> CGRect
-
Undocumented
Declaration
Objective-C
+ (void)qmui_animateWithAnimated:(BOOL)animated duration:(NSTimeInterval)duration delay:(NSTimeInterval)delay options:(UIViewAnimationOptions)options animations:(void (^)(void))animations completion:(void (^ __nullable)(BOOL finished))completion;
Swift
class func qmui_animateWith(animated: Bool, duration: TimeInterval, delay: TimeInterval, options: UIView.AnimationOptions = [], animations: @escaping () -> Void, completion: ((Bool) -> Void)? = nil)
-
Undocumented
Declaration
Objective-C
+ (void)qmui_animateWithAnimated:(BOOL)animated duration:(NSTimeInterval)duration animations:(void (^ __nullable)(void))animations completion:(void (^ __nullable)(BOOL finished))completion;
Swift
class func qmui_animateWith(animated: Bool, duration: TimeInterval, animations: (() -> Void)?, completion: ((Bool) -> Void)? = nil)
-
Undocumented
Declaration
Objective-C
+ (void)qmui_animateWithAnimated:(BOOL)animated duration:(NSTimeInterval)duration animations:(void (^ __nullable)(void))animations;
Swift
class func qmui_animateWith(animated: Bool, duration: TimeInterval, animations: (() -> Void)? = nil)
-
+qmui_animateWithAnimated:
duration: delay: usingSpringWithDamping: initialSpringVelocity: options: animations: completion: Undocumented
Declaration
Objective-C
+ (void)qmui_animateWithAnimated:(BOOL)animated duration:(NSTimeInterval)duration delay:(NSTimeInterval)delay usingSpringWithDamping:(CGFloat)dampingRatio initialSpringVelocity:(CGFloat)velocity options:(UIViewAnimationOptions)options animations:(void (^)(void))animations completion:(void (^)(BOOL finished))completion;
Swift
class func qmui_animateWith(animated: Bool, duration: TimeInterval, delay: TimeInterval, usingSpringWithDamping dampingRatio: CGFloat, initialSpringVelocity velocity: CGFloat, options: UIView.AnimationOptions = [], animations: @escaping () -> Void, completion: @escaping (Bool) -> Void)