-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathUIView+KCExtension.h
90 lines (75 loc) · 2.31 KB
/
UIView+KCExtension.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
//
// UIView+KCExtension.h
// categoryDemo
//
// Created by zhangweiwei on 16/5/6.
// Copyright © 2016年 Erica. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface UIView (KCExtension)
/*
* 快速设置frame、center、size
*/
@property (nonatomic, assign) CGFloat kc_x;
@property (nonatomic, assign) CGFloat kc_y;
@property (nonatomic, assign) CGFloat kc_maxX;
@property (nonatomic, assign) CGFloat kc_maxY;
@property (nonatomic, assign) CGFloat kc_centerX;
@property (nonatomic, assign) CGFloat kc_centerY;
@property (nonatomic, assign) CGFloat kc_width;
@property (nonatomic, assign) CGFloat kc_height;
@property (nonatomic, assign) CGSize kc_size;
@property (nonatomic, assign) CGPoint kc_center;
/*
* transform后获取四个点真实坐标
*/
// 原来的frame
-(CGRect)kc_originalFrameAfterTransform;
// 以下为4个点坐标
-(CGPoint)kc_topLeftAfterTransform;
-(CGPoint)kc_topRightAfterTransform;
-(CGPoint)kc_bottomLeftAfterTransform;
-(CGPoint)kc_bottomRightAfterTransform;
/*
* 截取view上正在显示的内容
*/
// 整个view内容截取
- (UIImage *)kc_screenshot;
// 指定区域截取
- (UIImage *)kc_screenshotWithRect:(CGRect)rect;
/**
* 是否显示在屏幕上
*/
- (BOOL)kc_isDisplayOnScreen;
/*
* 快速创建分割线view
*/
// 白色分割线
+ (instancetype)kc_whiteSeparator;
// 黑色分割线
+ (instancetype)kc_blackSeparator;
/*
* 加载XIB
*/
// 从xib加载view
+ (instancetype)kc_viewFromXib;
// 获取view的xib对象
+ (UINib *)kc_xib;
/*
* 显示红点, 默认在右上角
*/
@property (nonatomic, copy) NSString *kc_badgeValue;
- (void)kc_setBadgeValue:(NSString *)badgeValue offset:(CGPoint)offset;
/*
* 图层相关
*/
@property (nonatomic, strong) UIColor *kc_layerBackgroundColor;
@property (nonatomic, strong) UIColor *kc_layerBorderColor;
@property (nonatomic, assign) CGFloat kc_layerBorderWidth;
@property (nonatomic, assign) CGFloat kc_layerCornerRadius;
- (void)kc_setLayerCornerRadiusWithClips:(CGFloat)cornerRadius;
- (void)kc_setBorderWithWidth:(CGFloat)width cornerRadius:(CGFloat)radius color:(UIColor *)color;
- (void)kc_setBorderWithWidth:(CGFloat)width cornerRadius:(CGFloat)radius color:(UIColor *)color roundingCorners:(UIRectCorner)corners;
// 增加圆角遮盖
- (void)kc_setRoundedCoverWithBackgroundColor:(UIColor *)color cornerRadius:(CGFloat)radius;
@end