CLUIKit

CLUIKit profile

CLUIKit is an extension of UIKit API of the system, as well as some SELF-encapsulated UI. The usage of API is all in CLUIKitExample. If you have any doubts in using the library, please feel free to issue to me.

Supports CocoaPod management

pod ‘CLUIKit’

support

If you think it’s great, you can give me a tip. Thank you

CLAnimatorManager

CLAnimatorManager is a system-specific library wrapped in UIViewPropertyAnimator, available only on systems after iOS 10.

UICubicTimingParameters

- (void)cl_cubicTimingParametersWithDuration:(NSTimeInterval)duration
                                       curve:(UIViewAnimationCurve)curve
                                  animations:(CLAnimatorManagerBlock)animations NS_AVAILABLE_IOS(10_0);

- (void)cl_cubicTimingParametersWithDuration:(NSTimeInterval)duration
                                       curve:(UIViewAnimationCurve)curve
                                  animations:(CLAnimatorManagerBlock)animations
                                  completion:(CLAnimatorManagerCompleteBlock)completion NS_AVAILABLE_IOS(10_0);

- (void)cl_cubicTimingParametersWithDuration:(NSTimeInterval)duration
                               controlPoint1:(CGPoint)controlPoint1
                               controlPoint2:(CGPoint)controlPoint2
                                  animations:(CLAnimatorManagerBlock)animations NS_AVAILABLE_IOS(10_0);

- (void)cl_cubicTimingParametersWithDuration:(NSTimeInterval)duration
                               controlPoint1:(CGPoint)controlPoint1
                               controlPoint2:(CGPoint)controlPoint2
                                  animations:(CLAnimatorManagerBlock)animations
                                  completion:(CLAnimatorManagerCompleteBlock)completion NS_AVAILABLE_IOS(10_0);
Copy the code

UISpringTimingParameters

- (void)cl_springTimingParametersWithDuration:(NSTimeInterval)duration
                                 dampingRatio:(CGFloat)dampingRatio
                                   animations:(CLAnimatorManagerBlock)animations NS_AVAILABLE_IOS(10_0);

- (void)cl_springTimingParametersWithDuration:(NSTimeInterval)duration
                                 dampingRatio:(CGFloat)dampingRatio
                                   animations:(CLAnimatorManagerBlock)animations
                                   completion:(CLAnimatorManagerCompleteBlock)completion NS_AVAILABLE_IOS(10_0);

- (void)cl_springTimingParametersWithDuration:(NSTimeInterval)duration
                                 dampingRatio:(CGFloat)dampingRatio
                                     velocity:(CGVector)velocity
                                   animations:(CLAnimatorManagerBlock)animations NS_AVAILABLE_IOS(10_0);

- (void)cl_springTimingParametersWithDuration:(NSTimeInterval)duration
                                 dampingRatio:(CGFloat)dampingRatio
                                     velocity:(CGVector)velocity
                                   animations:(CLAnimatorManagerBlock)animations
                                   completion:(CLAnimatorManagerCompleteBlock)completion NS_AVAILABLE_IOS(10_0);

- (void)cl_springTimingParametersWithDuration:(NSTimeInterval)duration
                                         mass:(CGFloat)mass
                                    stiffness:(CGFloat)stiffness
                                      damping:(CGFloat)damping
                                     velocity:(CGVector)velocity
                                   animations:(CLAnimatorManagerBlock)animations NS_AVAILABLE_IOS(10_0);

- (void)cl_springTimingParametersWithDuration:(NSTimeInterval)duration
                                         mass:(CGFloat)mass
                                    stiffness:(CGFloat)stiffness
                                      damping:(CGFloat)damping
                                     velocity:(CGVector)velocity
                                   animations:(CLAnimatorManagerBlock)animations
                                   completion:(CLAnimatorManagerCompleteBlock)completion NS_AVAILABLE_IOS(10_0);
Copy the code

UIViewPropertyAnimator

typedef void(^CLAnimatorManagerBlock)(void);
typedef void(^CLAnimatorManagerCompleteBlock)(UIViewAnimatingPosition finalPosition);
typedef void(^CLAnimatorManagerStatusBlock)(UIViewAnimatingState state);

@property (nonatomic, strong, readonly) UIViewPropertyAnimator *cl_viewPropertyAnimator;

- (void)cl_viewPropertyAnimatorWithDuration:(NSTimeInterval)duration
                           timingParameters:(id <UITimingCurveProvider>)parameters
                                 animations:(CLAnimatorManagerBlock)animations NS_AVAILABLE_IOS(10_0);

- (void)cl_viewPropertyAnimatorWithDuration:(NSTimeInterval)duration
                           timingParameters:(id <UITimingCurveProvider>)parameters
                                 animations:(CLAnimatorManagerBlock)animations
                                 completion:(CLAnimatorManagerCompleteBlock)completion NS_AVAILABLE_IOS(10_0);

- (void)cl_viewPropertyAnimatorWithDuration:(NSTimeInterval)duration
                                      curve:(UIViewAnimationCurve)curve
                                 animations:(CLAnimatorManagerBlock)animations NS_AVAILABLE_IOS(10_0);

- (void)cl_viewPropertyAnimatorWithDuration:(NSTimeInterval)duration
                                      curve:(UIViewAnimationCurve)curve
                                 animations:(CLAnimatorManagerBlock)animations
                                 completion:(CLAnimatorManagerCompleteBlock)completion NS_AVAILABLE_IOS(10_0);

- (void)cl_viewPropertyAnimatorWithDuration:(NSTimeInterval)duration
                              controlPoint1:(CGPoint)point1
                              controlPoint2:(CGPoint)point2
                                 animations:(CLAnimatorManagerBlock)animations NS_AVAILABLE_IOS(10_0);

- (void)cl_viewPropertyAnimatorWithDuration:(NSTimeInterval)duration
                              controlPoint1:(CGPoint)point1
                              controlPoint2:(CGPoint)point2
                                 animations:(CLAnimatorManagerBlock)animations
                                 completion:(CLAnimatorManagerCompleteBlock)completion NS_AVAILABLE_IOS(10_0);

- (void)cl_viewPropertyAnimatorWithDuration:(NSTimeInterval)duration
                               dampingRatio:(CGFloat)ratio
                                 animations:(CLAnimatorManagerBlock)animations NS_AVAILABLE_IOS(10_0);

- (void)cl_viewPropertyAnimatorWithDuration:(NSTimeInterval)duration
                               dampingRatio:(CGFloat)ratio
                                 animations:(CLAnimatorManagerBlock)animations
                                 completion:(CLAnimatorManagerCompleteBlock)completion NS_AVAILABLE_IOS(10_0);

- (void)cl_viewPropertyAnimatorWithDuration:(NSTimeInterval)duration
                                 afterDelay:(NSTimeInterval)delay
                                    options:(UIViewAnimationOptions)options
                                 animations:(CLAnimatorManagerBlock)animations
                                 completion:(CLAnimatorManagerCompleteBlock)completion NS_AVAILABLE_IOS(10_0);
Copy the code

UIViewPropertyAnimator control related

- (void)cl_starViewPropertyAnimator;

- (void)cl_starViewPropertyAnimatorAfterDelay:(NSTimeInterval)delay;

- (void)cl_pauseViewPropertyAnimator;

- (void)cl_stopViewPropertyAnimator:(BOOL)stop;

- (void)cl_finishViewPropertyAnimatorWithPosition:(UIViewAnimatingPosition)position;
Copy the code

CLButton@

CLButton encapsulates the system UIButton and adds some features:

typedef NS_ENUM(NSInteger, CLButtonStyle) {
    
    CLButtonImageTopStyle = 0,
    CLButtonImageLeftStyle,
    CLButtonImageBottomStyle,
    CLButtonImageRightStyle
};

@property (nonatomic, assign) CLButtonStyle cl_buttomImageStyle;
@property (nonatomic, assign) CGFloat cl_imageSpacing;
@property (nonatomic, assign) CGSize cl_imageSize;
Copy the code

CLCollectionViewController@

CLCollectionViewController is on the system UIViewController + UICollectionView encapsulation and added some features:

- (void)cl_hiddenCollectionViewScrollIndicator;
Copy the code

UICollectionView MJRefresh @

- (void)cl_removeRefresh;

- (void)cl_removeHeaderRefresh;

- (void)cl_removeFooterRefresh;

- (void)cl_dropDownRefresh;

- (void)cl_dropDownBeginRefresh;

- (void)cl_dropDownEndRefresh;

- (void)cl_pullUpRefresh;

- (void)cl_pullUpBeginRefresh;

- (void)cl_pullUpEndRefresh;

- (void)cl_endCollectionViewRefreshWithType:(CLCollectionViewRefreshType)refreshType;
Copy the code

UICollectionView agent and data source @

- (void)cl_setCollectionViewDelegate:(_Nullable id <UICollectionViewDelegate>)delegate dataSource:(_Nullable id <UICollectionViewDataSource>)dataSource; - (void)cl_setCollectionViewDragDelegate:(_Nullable id <UICollectionViewDragDelegate>)dragDelegate DropDelegate: (_Nullable id < UICollectionViewDropDelegate >) dropDelegate API_AVAILABLE (ios (11.0));Copy the code

registered

- (void)cl_registerClass:(nullable Class)cellClass
              identifier:(NSString *)identifier;
Copy the code

CLCollectionViewDataSource@

CLCollectionViewDataSource is CLCollectionViewController data source, need to cooperate with:

@property (nonatomic, weak, readonly) CLCollectionViewViewModel *cl_viewModel;

- (instancetype)initCollectionViewDataSourceWithViewModel:(CLCollectionViewViewModel *)viewModel;
Copy the code

CLCollectionViewDelegate@

CLCollectionViewDelegate CLCollectionViewController agent, need to cooperate with:

@property (nonatomic, weak, readonly) CLCollectionViewViewModel *cl_viewModel;

- (instancetype)initCollectionViewDelegateWithViewModel:(CLCollectionViewViewModel *)viewModel;
Copy the code

CLCollectionViewDragDelegate@

CLCollectionViewDragDelegate CLCollectionViewController agent, need to cooperate with:

@property (nonatomic, weak, readonly) CLCollectionViewViewModel *cl_viewModel;

- (instancetype)initCollectionViewDragDelegateWithViewModel:(CLCollectionViewViewModel *)viewModel;
Copy the code

CLCollectionViewDropDelegate@

CLCollectionViewDropDelegate CLCollectionViewController agent, need to cooperate with:

@property (nonatomic, weak, readonly) CLCollectionViewViewModel *cl_viewModel;

- (instancetype)initCollectionViewDropDelegateWithViewModel:(CLCollectionViewViewModel *)viewModel;
Copy the code

CLCollectionViewViewModel

CLCollectionViewViewModel CLCollectionViewController ViewModel, need to cooperate with:

@property (nonatomic, weak, readonly) CLCollectionViewController *cl_collectionViewController;

@property (nonatomic, strong) NSMutableArray *cl_dataSource;

- (instancetype)initCollectionViewBaseModelWithController:(CLCollectionViewController *)viewController;

- (void)cl_collectionViewHTTPRequest;
Copy the code

CLNavigationController@

CLNavigationController is a wrapper around the system UINavigationController and adds some features:

@property (nonatomic, strong) UIImage *cl_backgroundImage;

@property (nonatomic, strong) UIColor *cl_tintColor;

@property (nonatomic, strong) UIColor *cl_foregroundColor;

@property (nonatomic, strong) UIImage *cl_shadowImage;
Copy the code

CLNavigationController default overloads the pushViewController: animated:, when pushViewController automatically hidden UITarBar.

CLScanQRCodeController@

CLScanQRCodeController is a QRCode scan library encapsulated based on AVFoundation. The system identifies 13 codes by default:

@property (nonatomic, strong) UIView *cl_scanQRCodeView;

@property (nonatomic, assign) BOOL cl_autoStopCaptureSessionRunning;

@property (nonatomic, weak) id <CLScanQRCodeControllerDelegate> cl_scanQRCodeControllerDelegate;

- (void)cl_startCaptureSessionRunning;

- (void)cl_stopCaptureSessionRunning;
Copy the code

Get data (Block)@

@property (nonatomic, copy) void(^cl_scanQRCodeGetMetadataObjectsBlock)(NSArray *metadataObjects);

@property (nonatomic, copy) void(^cl_scanQRCodeGetMetadataStringValue)(NSString *stringValue);
Copy the code

Get data (Delegate)@

- (void)cl_scanQRCodeGetMetadataObjectsWithMetadataObjects:(NSArray *)metadataObjects;

- (void)cl_scanQRCodeGetMetadataStringValue:(NSString *)stringValue;
Copy the code

CLScrollViewController@

CLScrollViewController is a wrapper based on the system UIViewController+UIScrollView and adds some features:

@property (nonatomic, strong, readonly) UIScrollView *cl_scrollView;

- (void)cl_hiddenScrollIndicator;
Copy the code

UIScrollView agent @

- (void)cl_setScrollViewDelegate:(_Nullable id <UIScrollViewDelegate>)delegate;
Copy the code

CLScrollViewViewModel

@property (nonatomic, weak, readonly) CLScrollViewController *cl_scrollViewController;

- (instancetype)initScrollViewDelegateWithController:(CLScrollViewController *)controller;
Copy the code

CLTableViewController@

CLTableViewController is a wrapper around the system UIViewController + UITableView and adds some features:

@property (nonatomic, strong, null_resettable, readonly) UITableView *cl_tableView;

- (instancetype)initTableViewControllerWithStyle:(UITableViewStyle)style;

- (void)cl_hiddenTableViewScrollIndicator;
Copy the code

UITableView and MJRefresh @

- (void)cl_removeRefresh;

- (void)cl_removeHeaderRefresh;

- (void)cl_removeFooterRefresh;

- (void)cl_dropDownRefresh;

- (void)cl_dropDownBeginRefresh;

- (void)cl_dropDownEndRefresh;

- (void)cl_pullUpRefresh;

- (void)cl_pullUpBeginRefresh;

- (void)cl_pullUpEndRefresh;

- (void)cl_endTableViewRefreshWithType:(CLTableViewRefreshType)refreshType;
Copy the code

UITableView agent with data source @

- (void)cl_setTableViewDelegate:(_Nullable id <UITableViewDelegate>)delegate dataSource:(_Nullable id <UITableViewDataSource>)dataSource; - (void)cl_setTableViewDragDelegate:(_Nullable id <UITableViewDragDelegate>)dragDelegate dropDelegate:(_Nullable id < UITableViewDropDelegate >) dropDelegate API_AVAILABLE (ios (11.0));Copy the code

CLTableViewDataSource@

CLTableViewDataSource is the data source of the CLTableViewController.

@property (nonatomic, weak, readonly) CLTableViewViewModel *cl_viewModel;

- (instancetype)initTableViewDataSourceWithViewModel:(CLTableViewViewModel *)viewModel;
Copy the code

CLTableViewDelegate@

CLTableViewDelegate is the CLTableViewController’s delegate and needs to work with it:

@property (nonatomic, weak, readonly) CLTableViewViewModel *cl_viewModel;

- (instancetype)initTableViewDelegateWithViewModel:(CLTableViewViewModel *)viewModel;
Copy the code

CLTableViewDragDelegate@

CLTableViewDragDelegate is the CLTableViewController’s delegate and needs to work with it:

@property (nonatomic, weak, readonly) CLTableViewViewModel *cl_viewModel;

- (instancetype)initTableViewDragDelegateWithViewModel:(CLTableViewViewModel *)viewModel;
Copy the code

CLTableViewDropDelegate@

CLTableViewDropDelegate is the CLTableViewController’s delegate and needs to work with it:

@property (nonatomic, weak, readonly) CLTableViewViewModel *cl_viewModel;

- (instancetype)initTableViewDropDelegateWithViewModel:(CLTableViewViewModel *)viewModel;
Copy the code

CLTableViewViewModel@

CLTableViewViewModel is the ViewModel of CLTableViewController.

@property (nonatomic, strong) NSMutableArray *cl_dataSource;

@property (nonatomic, weak, readonly) CLTableViewController *cl_tableViewController;

- (instancetype)initTableViewBaseModelWithController:(CLTableViewController *)viewController;

- (void)cl_tableViewHTTPRequest;

- (void)cl_configTableViewWithDataSource;
Copy the code

The principle of CLTableViewController encapsulation: Playing iOS development: Building a low-coupling reusable TableViewController.

CLTextField@

CLTextField is a wrapper around the system UITextField and adds some features:

typedef NS_ENUM(NSInteger, CLTextFieldType) {
    
    CLTextFieldBottomNormal = 0, // default
    CLTextFieldBottomLineType
};

@property (nonatomic, assign) CLTextFieldType cl_textFieldType;

@property (nonatomic, strong) UIColor *cl_lineColor;
Copy the code

CLToolBarListView@

CLToolBarListView is a horizontal menu bar control encapsulated on the system UIView (a more flexible control will be refactored in the future):

typedef NS_ENUM(NSInteger, CLToolBarStyle) {
    CLToolBarNormalStyle = 0,
    CLToolBarSeparationStyle
};

- (instancetype)initToolBarWithFrame:(CGRect)frame;

@property (nonatomic, assign) CLToolBarStyle cl_toolBarStyle;

@property (nonatomic, assign) BOOL cl_titleAdjustsFontSizeToFitWidth;

@property (nonatomic, strong) NSArray  *cl_titleArray;

@property (nonatomic, strong) UIColor *cl_selectedColor;

@property (nonatomic, strong) UIColor *cl_deselectColor;

@property (nonatomic, strong) UIColor *cl_barBakcgroundColor;

@property (nonatomic, strong) UIColor *cl_bottomLineColor;

@property (nonatomic, strong) UIColor *cl_selectedLineColor;

@property (nonatomic, assign) NSInteger cl_textFont;

@property (nonatomic, assign) CGFloat cl_buttonSpacing;

@property (nonatomic, assign) BOOL cl_isNeedLine;

@property (nonatomic, assign) BOOL cl_isNeedSelectedLine;

@property (nonatomic, getter=currentIndex) NSInteger cl_currentIndex;

#pragma mark - Tool Bar Separation Style Property
@property (nonatomic, strong) UIColor *cl_separationColor;

@property (nonatomic, assign) CGFloat cl_separationWidth;

#pragma mark - Common Method
- (void)cl_reloadData;

- (void)cl_didSelectedButton:(NSInteger)index;

@property (nonatomic, copy) void(^cl_toolBarSelectedBlock)(NSInteger index);
Copy the code

CLToolBarListView is a horizontal slider that can be used for iOS development.

CLViewController@

CLViewController encapsulates the system UIViewController and adds some features:

typedef NS_ENUM(NSInteger, CLViewControllerStyle) {
    
    CLMainViewController = 0, // Default
    CLChildViewController
};

- (instancetype)initCLViewControllerWith:(CLViewControllerStyle)style;
Copy the code

CLViewControllerViewModel@

CLViewControllerViewModel is CLViewController ViewModel, the system needs to cooperate to use:

@property (nonatomic, weak, readonly) CLViewController *cl_viewController;

- (instancetype)initViewControllerViewModelWithController:(CLViewController *)controller;
Copy the code

CLWebViewController@

CLWebViewController encapsulates the system UIViewController + WKWebView and adds some features:

@property (nonatomic, strong, readonly) WKWebView *cl_webView;

- (void)cl_setWebViewUIDelegate:(_Nullable id <WKUIDelegate>)UIDelegate
             navigationDelegate:(_Nullable id <WKNavigationDelegate>)navigationDelegate;
Copy the code

CLWebViewNavigationDelegate

CLWebViewNavigationDelegate is CLWebViewController WKNavigationDelegate, need to cooperate with:

@property (nonatomic, weak, readonly) CLWebViewViewModel *cl_viewModel;

- (instancetype)initWebViewNavigationDelegateWithViewModel:(CLWebViewViewModel *)viewModel;
Copy the code

CLWebViewUIDelegate

CLWebViewUIDelegate is the UIDelegate of CLWebViewController and needs to be used in conjunction with:

@property (nonatomic, weak, readonly) CLWebViewViewModel *cl_viewModel;

- (instancetype)initWebViewUIDelegateWithViewModel:(CLWebViewViewModel *)viewModel;
Copy the code

CLWebViewViewModel

CLWebViewViewModel is the ViewModel of CLWebViewController.

@property (nonatomic, weak, readonly) CLWebViewController *cl_webViewController;

- (instancetype)initWebViewModelWithController:(CLWebViewController *)controller;
Copy the code

UIApplication+CLApplication@

Method supplement for UIKit UIApplication outside the system:

+ (BOOL)cl_getApplicationLocationPermit;

+ (BOOL)cl_getApplicationAddressBookPermit;

+ (BOOL)cl_getApplicationCameraPermit;

+ (BOOL)cl_getApplicationRemindersPermit;

+ (BOOL)cl_getApplicationPhotosLibraryPermit;

+ (void)cl_getApplicationMicrophonePermitWithBlock:(CLPermissionBlock)block;

+ (void)cl_callPhoneWithPhoneNumber:(NSString *)phoneNumber;

+ (void)cl_sendEmailWithEmailAddress:(NSString *)emailAddress;

+ (void)cl_goToAppSetting;

+ (UIImage *)cl_getApplicationLaunchImage;

+ (CGFloat)cl_getStatusBarHeight;
Copy the code

UIButton+CLButton@

UIButton (UIKit); UIButton (UIKit);

typedef NS_ENUM(NSInteger, CLButtonStarStyle) { CLButtonStarStyleBegin = 0, CLButtonStarStyleFinish }; typedef void(^CLButtonStar)(UIButton *cl_starButton, CLButtonStarStyle cl_buttonStarStyle, NSInteger time); typedef void (^CLButtonAction)(UIButton *sender); @interface UIButton (CLButton) @property (nonatomic, assign) UIEdgeInsets cl_clickAreaEdgeInsets; @property (nonatomic, assign, readonly) BOOL cl_isSubmitting; #pragma mark - countdown method - (void)cl_starButtonWithTime:(NSInteger)time complete:(CLButtonStar)complete; #pragma mark - add UIButton click method - (void)cl_addButtonActionComplete:(CLButtonAction)complete; #pragma Mark - use UIActivityIndicatorView instead of text - (void)cl_showActivityIndicatorViewWithStyle:(UIActivityIndicatorViewStyle)style; - (void)cl_hideActivityIndicatorView; # pragma mark - set UIButton image - (void) cl_setNormalButtonWithImage: UIImage *) image; - (void)cl_setNormalButtonImageWithColor:(UIColor *)color; - (void)cl_setHighlightedButtonWithImage:(UIImage *)image; - (void)cl_setHighlightedButtonImageWithColor:(UIColor *)color; - (void)cl_setSelectedButtonWithImage:(UIImage *)image; - (void)cl_setSelectedButtonImageWithColor:(UIColor *)color; - (void)cl_setDisabledButtonWithImage:(UIImage *)image; - (void)cl_setDisabledButtonImageWithColor:(UIColor *)color; # pragma mark - sets UIButton background image - (void) cl_setNormalButtonBackgroundImageWithImage: UIImage *) image; - (void)cl_setHighlightedButtonBackgroundImageWithImage:(UIImage *)image; - (void)cl_setSelectedButtonBackgroundImageWithImage:(UIImage *)image; - (void)cl_setDisabledButtonBackgroundImageWithImage:(UIImage *)image; #pragma mark - get UIButton image - (UIImage *)cl_getNormalButtonImage; - (UIImage *)cl_getHighlightedButtonImage; - (UIImage *)cl_getSelectedButtonImage; - (UIImage *)cl_getDisabledButtonImage; # pragma mark - get a UIButton background image - (UIImage *) cl_getNormalButtonBackgroundImage; - (UIImage *)cl_getHighlightedButtonBackgroundImage; - (UIImage *)cl_getSelectedButtonBackgroundImage; - (UIImage *)cl_getDisabledButtonBackgroundImage; # pragma mark - set UIButton title - (void) cl_setNormalButtonWithTitle (nsstrings *) the title; - (void)cl_setHighlightedButtonWithTitle:(NSString *)title; - (void)cl_setSelectedButtonWithTitle:(NSString *)title; - (void)cl_setDisabledButtonWithTitle:(NSString *)title; #pragma mark - Get UIButton title - (NSString *)cl_getNormalButtonTitle; - (NSString *)cl_getHighlightedButtonTitle; - (NSString *)cl_getSelectedButtonTitle; - (NSString *)cl_getDisabledButtonTitle; #pragma mark - set UIButton title - (void)cl_setNormalTitleWithColor:(UIColor *)color; - (void)cl_setHighlightedTitleWithColor:(UIColor *)color; - (void)cl_setSelectedTitleWithColor:(UIColor *)color; - (void)cl_setDisabledTitleWithColor:(UIColor *)color; # pragma mark - get a UIButton title color - (UIColor *) cl_getNormalButtonTitleColor; - (UIColor *)cl_getHighlightedButtonTitleColor; - (UIColor *)cl_getSelectedButtonTitleColor; - (UIColor *)cl_getDisabledButtonTitleColor; # pragma mark - set UIButton NSAttributedString title - (void) cl_setNormalButtonWithAttributedStringTitle: (NSAttributedString *)attributedString; - (void)cl_setHighlightedButtonWithAttributedStringTitle:(NSAttributedString *)attributedString; - (void)cl_setSelectedButtonWithAttributedStringTitle:(NSAttributedString *)attributedString; - (void)cl_setDisabledButtonWithAttributedStringTitle:(NSAttributedString *)attributedString; # pragma mark - get a UIButton title - (NSAttributedString *) cl_getNormalButtonAttributedStringTitle; - (NSAttributedString *)cl_getHighlightedButtonAttributedStringTitle; - (NSAttributedString *)cl_getSelectedButtonAttributedStringTitle; - (NSAttributedString *)cl_getDisabledButtonAttributedStringTitle;Copy the code

UICollectionView+CLCollectionView@

UIKit UICollectionView:

UICollectionView placeholder agent @

@protocol CLCollectionViewPlaceholderDelegate <NSObject>

@required

- (UIView *)cl_placeholderView;

@optional

- (BOOL)cl_scrollEnabledWithShowPlaceholderView;

@end
Copy the code

UICollectionView refresh @

- (void)cl_reloadData;

- (void)cl_removePlaceholderViewWithSuperView;
Copy the code

UIColor+CLColor@

UIKit UIColor (UIKit UIColor)

+ (UIColor *)cl_getARC4RandomColor;

+ (UIColor *)cl_colorWithHex:(NSInteger)hexValue;

+ (UIColor *)cl_colorWithHex:(NSInteger)hexValue
                       alpha:(CGFloat)alphaValue;

+ (UIColor *)cl_colorWithHexString:(NSString *)hexString;

+ (UIColor *)cl_colorWithHexString:(NSString *)hexString
                             alpha:(CGFloat)alphaValue;

+ (UIColor *)cl_colorWithRed:(CGFloat)red
                       green:(CGFloat)green
                        blue:(CGFloat)blue
                       alpha:(CGFloat)alpha;

+ (UIColor *)cl_colorWithRed:(CGFloat)red
                       green:(CGFloat)green
                        blue:(CGFloat)blue;

+ (UIColor *)cl_configGradientWithBeginColor:(UIColor *)beginColor
                                    endColor:(UIColor *)endColor
                                      height:(CGFloat)height;
Copy the code

UIControl+CLControl@

UIKit UIControl:

typedef void(^CLControlAction)(id sender);

@interface CLControlActionBlockObject : NSObject

@property (nonatomic, copy) CLControlAction cl_controlAction;

@property (nonatomic, assign) UIControlEvents cl_controlEvents;

- (void)cl_controlInvokeBlock:(id)sender;

@end

@interface UIControl (CLControl)

- (void)cl_addControlActionWithEvents:(UIControlEvents)controlEvents
                             complete:(CLControlAction)complete;

- (void)cl_setControlActionWithEvents:(UIControlEvents)controlEvents
                             complete:(CLControlAction)complete;

- (void)cl_removeControlActionWithEvents:(UIControlEvents)controlEvents;

- (void)cl_removeAllActions;

@end
Copy the code

UIDevice+CLDevice@

UIDevice UIKit UIDevice UIKit

Equipment related @

+ (NSString *)cl_getSystemVersion;

+ (NSString *)cl_getDeviceName;

+ (NSString *)cl_getDeviceModelType;

+ (NSString *)cl_getUUIDString;

+ (NSString *)cl_getCurrentDeviceModelName;

+ (BOOL)cl_isPad;

+ (BOOL)cl_isSimulator;

+ (BOOL)cl_isJailbroken;
Copy the code

CPU related @

+ (NSUInteger)cl_getCurrentDeviceCPUCount;

+ (CGFloat)cl_getCurrentDeviceAllCoreCPUUse;

+ (NSArray *)cl_getCurrentDeviceSingleCoreCPUUse;
Copy the code

Network related @

+ (NSString *)cl_getCarrierName;

+ (NSString *)cl_getCurrentRadioAccessTechnology;

+ (NSString *)cl_getCurrentDeviceIPAddresses;

+ (NSString *)cl_getCurrentDeviceIPAddressWithWiFi;

+ (NSString *)cl_getCurrentDeviceIPAddressWithCell;
Copy the code

Store correlation @

+ (int64_t)cl_getDiskSpace;

+ (int64_t)cl_getDiskSpaceFree;

+ (int64_t)cl_getDiskSpaceUsed;
Copy the code

Memory dependent @

+ (int64_t)cl_getMemoryTotal;

+ (int64_t)cl_getMemoryFree;

+ (int64_t)cl_getMemoryActive;

+ (int64_t)cl_getMemoryInactive;

+ (int64_t)cl_getMemoryWired;

+ (int64_t)cl_getMemoryPurgable;
Copy the code

UIFont+CLFont@

UIKit UIFont (UIKit UIFont)

+ (UIFont *)cl_fitSystemFontOfSize:(CGFloat)fontSize;

+ (UIFont *)cl_fitBoldSystemFontOfSize:(CGFloat)fontSize;

+ (UIFont *)cl_fitItalicSystemFontOfSize:(CGFloat)fontSize;

+ (UIFont *)cl_fitSystemFontOfSize:(CGFloat)fontSize
                            weight:(UIFontWeight)weight NS_AVAILABLE_IOS(8_2);

+ (UIFont *)cl_fitMonospacedDigitSystemFontOfSize:(CGFloat)fontSize
                                           weight:(UIFontWeight)weight NS_AVAILABLE_IOS(9_0);

+ (BOOL)cl_loadFontWithPath:(NSString *)path;

+ (void)cl_unloadFontWithPath:(NSString *)path;

+ (UIFont *)cl_loadFontWithData:(NSData *)data;

+ (BOOL)cl_unloadFontWithData:(UIFont *)font;

+ (UIFont *)cl_fitCustomFontWithName:(NSString *)name
                            fontSize:(CGFloat)fontSize;
Copy the code

UIImage+CLImage@

UIImage (UIKit);

Generates an image with the specified color @

+ (void)cl_asyncGetImageWithColor:(UIColor *)color
                       completion:(CLImage)completion;

+ (void)cl_asyncGetImageWithColor:(UIColor *)color
                             rect:(CGRect)rect
                       completion:(CLImage)completion;

+ (void)cl_asyncGetImageWithColor:(UIColor *)color
                           radius:(CGFloat)radius
                       completion:(CLImage)completion;

+ (void)cl_asyncGetImageWithColor:(UIColor *)color
                             rect:(CGRect)rect
                           radius:(CGFloat)radius
                       completion:(CLImage)completion;
Copy the code

Take a screenshot @ of the specified view size

+ (UIImage *)cl_getImageForView:(UIView *)view;
Copy the code

Scale the picture to a specified scale @

+ (void)cl_asyncDrawImageToSize:(CGSize)size
                          image:(UIImage *)image
                     completion:(CLImage)completion;
Copy the code

Load GIF image @

+ (void)cl_asyncLoadGIFImageForName:(NSString *)name
                         completion:(CLImage)completion;

+ (void)cl_asyncLoadGIFImageWithData:(NSData *)data
                          completion:(CLImage)completion;

+ (BOOL)cl_isAnimatedGIFWithData:(NSData *)data;

+ (BOOL)cl_isAnimatedGIFWithFilePath:(NSString *)filePath;
Copy the code

Generate qr code @

+ (void)cl_asyncCreateQRCodeImageWithString:(NSString *)string
                                 completion:(CLImage)completion;

+ (void)cl_asyncCreateQRCodeImageWithString:(NSString *)string
                                  logoImage:(UIImage *)logoImage
                                 completion:(CLImage)completion;
Copy the code

Generate bar code @

+ (void)cl_asyncCreate128BarcodeImageWithString:(NSString *)string
                                     completion:(CLImage)completion;

+ (void)cl_asyncCreate128BarcodeImageWithString:(NSString *)string
                                     imageSpace:(CGFloat)imageSpace
                                     completion:(CLImage)completion;
Copy the code

Get the picture @

+ (UIImage *)cl_getImageWithBundleName:(NSString *)bundle
                             imageName:(NSString *)imageName;

+ (void)cl_asyncGetVideoPreViewImageWithVideoURL:(NSURL *)videoURL
                                      completion:(CLImage)completion;
Copy the code

Image gaussian blur @

+ (void)cl_asyncBlurImageWithBlur:(CGFloat)blur
                            image:(UIImage *)image
                       completion:(CLImage)completion;
Copy the code

Picture fillet @

+ (void)cl_asyncCornerImageWithRadius:(CGFloat)radius
                                image:(UIImage *)image
                           completion:(CLImage)completion;

+ (void)cl_asyncCornerImageWithRadius:(CGFloat)radius
                                image:(UIImage *)image
                          borderWidth:(CGFloat)borderWidth
                          borderColor:(UIColor *)borderColor
                           completion:(CLImage)completion;
Copy the code

The image processing

+ (void)cl_resetSizeWithImage:(UIImage *)image
                         size:(CGSize)size
                   completion:(CLImage)completion;

+ (CGSize)cl_getScaleImageWithImage:(UIImage *)image
                             length:(CGFloat)length;
Copy the code

UINavigationController+CLNavigationController

UIKit UINavigationController:

- (UIViewController *)cl_findViewControllerWithClassName:(NSString *)className;

- (NSUInteger)cl_getIndexWithViewController:(UIViewController *)viewController;

- (UIViewController *)cl_getFirstViewController;

- (NSArray *)cl_popToViewControllerWithClassName:(NSString *)className
                                        animated:(BOOL)animated;

- (NSArray *)cl_popToViewControllerWithLevel:(NSUInteger)level
                                    animated:(BOOL)animated;

- (CGFloat)cl_getNavigationBarHeight;
Copy the code

UINavigationItem+CLNavigationItem@

UIKit UINavigationItem (UIKit UINavigationItem)

There is no external API provided here, the internal implementation changed the title of the UINavigationBar backItem before iOS 11, and if it didn’t need to be changed, Please comment #import “UINavigationItem+ clnavigationitem.h “in cluikit. h

UIScreen+CLScreen@

UIKit UIScreen (UIKit UIScreen)

+ (CGFloat)cl_getScreenScale;

+ (CGSize)cl_getScreenSize;

+ (CGRect)cl_getCurrentScreenBounds;

+ (CGFloat)cl_getScreenWidth;

+ (CGFloat)cl_getScreenHeight;

+ (CGFloat)cl_fitScreen:(CGFloat)value;

+ (CGFloat)cl_getStatusBarHeight;

+ (CGFloat)cl_getNavigationBarHeight;

+ (CGFloat)cl_getTabBarHeight;
Copy the code

UIScrollView+CLScrollView

UIKit UIScrollView (UIKit UIScrollView)

- (void)cl_scrollViewToTopWithAnimated:(BOOL)animated;

- (void)cl_scrollViewToLeftWithAnimated:(BOOL)animated;

- (void)cl_scrollViewToBottomWithAnimated:(BOOL)animated;

- (void)cl_scrollViewToRightWithAnimated:(BOOL)animated;
Copy the code

UITableView+CLTableView@

UIKit UITableView ();

UITableView+CLTableView placeholder @

@protocol CLTableViewPlaceholderDelegate <NSObject>

@required

- (UIView *)cl_placeholderView;

@optional

- (BOOL)cl_calculateTableViewHeaderViewFrame;

- (BOOL)cl_scrollEnabledWithShowPlaceholderView;

@end

- (void)cl_removePlaceholderViewWithSuperView;
Copy the code

UITableView + CLTableView refresh @

typedef void(^CLTableViewUpdateBlock)(UITableView *tableView);

- (void)cl_reloadData;


- (void)cl_updateTableViewWithComplete:(CLTableViewUpdateBlock)complete;

- (void)cl_reloadRowWithIndexPath:(NSIndexPath *)indexPath
                        animation:(UITableViewRowAnimation)animation;

- (void)cl_reloadWithSection:(NSUInteger)section
                   animation:(UITableViewRowAnimation)animation;

- (void)cl_reloadWithRow:(NSUInteger)row
                 section:(NSUInteger)section
               animation:(UITableViewRowAnimation)animation;
Copy the code

UITableView + CLTableView IndexPath

- (void)cl_scrollToIndexPath:(NSIndexPath *)indexPath
              scrollPosition:(UITableViewScrollPosition)scrollPosition
                    animated:(BOOL)animated;

- (void)cl_scrollToRow:(NSUInteger)row
               section:(NSUInteger)section
        scrollPosition:(UITableViewScrollPosition)scrollPosition
              animated:(BOOL)animated;
Copy the code

UITableView + CLTableView insert IndexPath @

- (void)cl_insertRowWithIndexPath:(NSIndexPath *)indexPath
                        animation:(UITableViewRowAnimation)animation;

- (void)cl_insertWithSection:(NSUInteger)section
                   animation:(UITableViewRowAnimation)animation;

- (void)cl_insertWithRow:(NSUInteger)row
                 section:(NSUInteger)section
               animation:(UITableViewRowAnimation)animation;

Copy the code

UITableView + delete CLTableView IndexPath @

- (void)cl_deleteRowWithIndexPath:(NSIndexPath *)indexPath
                        animation:(UITableViewRowAnimation)animation;

- (void)cl_deleteWithSection:(NSUInteger)section
                   animation:(UITableViewRowAnimation)animation;

- (void)cl_deleteWithRow:(NSUInteger)row
                 section:(NSUInteger)section
               animation:(UITableViewRowAnimation)animation;

- (void)cl_resetSelectedRowsAnimated:(BOOL)animated;
Copy the code

UIView+CLView@

UIKit UIView (UIView);

Internal implementation changes the title of UINavigationBar backItem in iOS 11. If you don’t need to change it, please comment #import “UIView+ clview.h “in cluikit. h.

typedef void (^CLGestureActionBlock)(UIGestureRecognizer *gestureRecoginzer);

@property (nonatomic, assign) CGSize cl_size;

@property (nonatomic, assign) CGFloat cl_width;
@property (nonatomic, assign) CGFloat cl_height;
@property (nonatomic, assign) CGFloat cl_top;
@property (nonatomic, assign) CGFloat cl_left;
@property (nonatomic, assign) CGFloat cl_bottom;
@property (nonatomic, assign) CGFloat cl_right;
@property (nonatomic, assign) CGFloat cl_centerX;
@property (nonatomic, assign) CGFloat cl_centerY;

- (void)cl_addTapGestureRecognizerWithBlock:(CLGestureActionBlock)block;

- (void)cl_addLongPressGestureRecognizerWithBlock:(CLGestureActionBlock)block;

- (id)cl_getSubViewWithSubViewClass:(Class)objcClass;

- (id)cl_getSuperViewWithSuperViewClass:(Class)objcClass;

- (BOOL)cl_resignFirstResponder;

- (UIView *)cl_getFirstResponder;

Copy the code

UIViewController+CLViewController@

UIViewController (UIViewController, UIKit);

UIViewControllerBackItem Check agent @

@protocol CLNavigationControllerBackItemProtocol <NSObject>
@optional

- (BOOL)cl_navigationShouldPopOnBackButton;

@end
Copy the code

@ UIViewController + CLViewController method

- (BOOL)cl_navigationShouldPopOnBackButton; - (void)cl_setNavigationBarTranslucentWithBOOL:(BOOL)bools; - (void)cl_setTabBarTranslucentWithBOOL:(BOOL)bools; # pragma mark - call mobile phones - (void) cl_callPhoneWithPhoneNumber: (nsstrings *) phoneNumber message: (nsstrings *) message titile:(NSString *)title; # pragma mark - UIAlertController custom - (void) cl_showAlertViewControllerWithTitle: (nsstrings *) title message: (nsstrings *)message buttonTitle:(NSString *)buttonTitle; - (void)cl_showSheetViewControllerWithTitle:(NSString *)title message:(NSString *)message actionTitles:(NSArray<NSString  *> *)actionTitles complete:(CLAlertControlAction)complete; - (void)cl_showAlertViewControllerWithTitle:(NSString *)title message:(NSString *)message actionTitles:(NSArray<NSString  *> *)actionTitles complete:(CLAlertControlAction)complete; - (void)cl_showAlertViewControllerWithTitle:(NSString *)title message:(NSString *)message actions:(NSArray<UIAlertAction  *> *)actions preferredStyle:(UIAlertControllerStyle)preferredStyle;Copy the code