CLUIKit
是對系統UIKit API
進行擴展, 以及一些本身封裝的UI
, API
的用法所有都在CLUIKitExample
裏, 若是在使用庫遇到的一些疑惑歡迎隨時Issues
給我.html
支持CocoaPod
管理ios
pod 'CLUIKit'git
若是您以爲挺讚的話, 能夠給我打賞打賞, 謝謝啦~github
CLAnimatorManager
是針對系統的UIViewPropertyAnimator
封裝的一個類庫, 只支持iOS 10
以後的系統.web
- (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);
複製代碼
- (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);
複製代碼
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);
複製代碼
- (void)cl_starViewPropertyAnimator;
- (void)cl_starViewPropertyAnimatorAfterDelay:(NSTimeInterval)delay;
- (void)cl_pauseViewPropertyAnimator;
- (void)cl_stopViewPropertyAnimator:(BOOL)stop;
- (void)cl_finishViewPropertyAnimatorWithPosition:(UIViewAnimatingPosition)position;
複製代碼
CLButton
是對系統UIButton
的封裝並添加了一些特性:objective-c
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;
複製代碼
CLCollectionViewController
是對系統UIViewController + UICollectionView
的封裝並添加了一些特性:spring
- (void)cl_hiddenCollectionViewScrollIndicator;
複製代碼
- (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;
複製代碼
- (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));
複製代碼
- (void)cl_registerClass:(nullable Class)cellClass
identifier:(NSString *)identifier;
複製代碼
CLCollectionViewDataSource
是CLCollectionViewController
的數據源, 須要配合着使用:網絡
@property (nonatomic, weak, readonly) CLCollectionViewViewModel *cl_viewModel;
- (instancetype)initCollectionViewDataSourceWithViewModel:(CLCollectionViewViewModel *)viewModel;
複製代碼
CLCollectionViewDelegate
是CLCollectionViewController
的代理, 須要配合着使用:app
@property (nonatomic, weak, readonly) CLCollectionViewViewModel *cl_viewModel;
- (instancetype)initCollectionViewDelegateWithViewModel:(CLCollectionViewViewModel *)viewModel;
複製代碼
CLCollectionViewDragDelegate
是CLCollectionViewController
的代理, 須要配合着使用:dom
@property (nonatomic, weak, readonly) CLCollectionViewViewModel *cl_viewModel;
- (instancetype)initCollectionViewDragDelegateWithViewModel:(CLCollectionViewViewModel *)viewModel;
複製代碼
CLCollectionViewDropDelegate
是CLCollectionViewController
的代理, 須要配合着使用:
@property (nonatomic, weak, readonly) CLCollectionViewViewModel *cl_viewModel;
- (instancetype)initCollectionViewDropDelegateWithViewModel:(CLCollectionViewViewModel *)viewModel;
複製代碼
CLCollectionViewViewModel
是CLCollectionViewController
的ViewModel
, 須要配合着使用:
@property (nonatomic, weak, readonly) CLCollectionViewController *cl_collectionViewController;
@property (nonatomic, strong) NSMutableArray *cl_dataSource;
- (instancetype)initCollectionViewBaseModelWithController:(CLCollectionViewController *)viewController;
- (void)cl_collectionViewHTTPRequest;
複製代碼
CLNavigationController
是針對系統UINavigationController
的封裝並添加了一些特性:
@property (nonatomic, strong) UIImage *cl_backgroundImage;
@property (nonatomic, strong) UIColor *cl_tintColor;
@property (nonatomic, strong) UIColor *cl_foregroundColor;
@property (nonatomic, strong) UIImage *cl_shadowImage;
複製代碼
CLNavigationController
默認重載了pushViewController:animated:
, 會在pushViewController
的時候自動隱藏掉UITarBar
.
CLScanQRCodeController
是基於AVFoundation
進行封裝的QRCode
掃描庫, 系統默認識別十三種編碼:
@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;
複製代碼
@property (nonatomic, copy) void(^cl_scanQRCodeGetMetadataObjectsBlock)(NSArray *metadataObjects);
@property (nonatomic, copy) void(^cl_scanQRCodeGetMetadataStringValue)(NSString *stringValue);
複製代碼
- (void)cl_scanQRCodeGetMetadataObjectsWithMetadataObjects:(NSArray *)metadataObjects;
- (void)cl_scanQRCodeGetMetadataStringValue:(NSString *)stringValue;
複製代碼
CLScrollViewController
是基於系統UIViewController+UIScrollView
的封裝並添加了一些特性:
@property (nonatomic, strong, readonly) UIScrollView *cl_scrollView;
- (void)cl_hiddenScrollIndicator;
複製代碼
- (void)cl_setScrollViewDelegate:(_Nullable id <UIScrollViewDelegate>)delegate;
複製代碼
@property (nonatomic, weak, readonly) CLScrollViewController *cl_scrollViewController;
- (instancetype)initScrollViewDelegateWithController:(CLScrollViewController *)controller;
複製代碼
CLTableViewController
是針對系統UIViewController + UITableView
的封裝並添加了一些特性:
@property (nonatomic, strong, null_resettable, readonly) UITableView *cl_tableView;
- (instancetype)initTableViewControllerWithStyle:(UITableViewStyle)style;
- (void)cl_hiddenTableViewScrollIndicator;
複製代碼
- (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;
複製代碼
- (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));
複製代碼
CLTableViewDataSource
是CLTableViewController
的數據源, 須要配合着使用:
@property (nonatomic, weak, readonly) CLTableViewViewModel *cl_viewModel;
- (instancetype)initTableViewDataSourceWithViewModel:(CLTableViewViewModel *)viewModel;
複製代碼
CLTableViewDelegate
是CLTableViewController
的代理, 須要配合着使用:
@property (nonatomic, weak, readonly) CLTableViewViewModel *cl_viewModel;
- (instancetype)initTableViewDelegateWithViewModel:(CLTableViewViewModel *)viewModel;
複製代碼
CLTableViewDragDelegate
是CLTableViewController
的代理, 須要配合着使用:
@property (nonatomic, weak, readonly) CLTableViewViewModel *cl_viewModel;
- (instancetype)initTableViewDragDelegateWithViewModel:(CLTableViewViewModel *)viewModel;
複製代碼
CLTableViewDropDelegate
是CLTableViewController
的代理, 須要配合着使用:
@property (nonatomic, weak, readonly) CLTableViewViewModel *cl_viewModel;
- (instancetype)initTableViewDropDelegateWithViewModel:(CLTableViewViewModel *)viewModel;
複製代碼
CLTableViewViewModel
是CLTableViewController
的ViewModel
, 須要配合着使用:
@property (nonatomic, strong) NSMutableArray *cl_dataSource;
@property (nonatomic, weak, readonly) CLTableViewController *cl_tableViewController;
- (instancetype)initTableViewBaseModelWithController:(CLTableViewController *)viewController;
- (void)cl_tableViewHTTPRequest;
- (void)cl_configTableViewWithDataSource;
複製代碼
關於CLTableViewController
封裝的原理: 玩轉iOS開發:打造一個低耦合可複用的《TableViewController》.
CLTextField
是針對系統UITextField
的封裝並添加了一些特性:
typedef NS_ENUM(NSInteger, CLTextFieldType) {
CLTextFieldBottomNormal = 0, // default
CLTextFieldBottomLineType
};
@property (nonatomic, assign) CLTextFieldType cl_textFieldType;
@property (nonatomic, strong) UIColor *cl_lineColor;
複製代碼
CLToolBarListView
是在系統UIView
上封裝的一個橫向菜單欄的控件(將來會重構一個更靈活的):
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);
複製代碼
關於CLToolBarListView的用法, 之前就寫過一篇文章, 你們能夠去看看玩轉iOS開發:橫向滑動條《CLToolBarListView》.
CLViewController
是對系統UIViewController
的封裝並添加了一些特性:
typedef NS_ENUM(NSInteger, CLViewControllerStyle) {
CLMainViewController = 0, // Default
CLChildViewController
};
- (instancetype)initCLViewControllerWith:(CLViewControllerStyle)style;
複製代碼
CLViewControllerViewModel
是對系統CLViewController
的ViewModel
, 須要配合使用:
@property (nonatomic, weak, readonly) CLViewController *cl_viewController;
- (instancetype)initViewControllerViewModelWithController:(CLViewController *)controller;
複製代碼
CLWebViewController
是對系統UIViewController
+ WKWebView
的封裝並添加了一些特性:
@property (nonatomic, strong, readonly) WKWebView *cl_webView;
- (void)cl_setWebViewUIDelegate:(_Nullable id <WKUIDelegate>)UIDelegate
navigationDelegate:(_Nullable id <WKNavigationDelegate>)navigationDelegate;
複製代碼
CLWebViewNavigationDelegate
是CLWebViewController
的WKNavigationDelegate
, 須要配合着使用:
@property (nonatomic, weak, readonly) CLWebViewViewModel *cl_viewModel;
- (instancetype)initWebViewNavigationDelegateWithViewModel:(CLWebViewViewModel *)viewModel;
複製代碼
CLWebViewUIDelegate
是CLWebViewController
的UIDelegate
, 須要配合着使用:
@property (nonatomic, weak, readonly) CLWebViewViewModel *cl_viewModel;
- (instancetype)initWebViewUIDelegateWithViewModel:(CLWebViewViewModel *)viewModel;
複製代碼
CLWebViewViewModel
是CLWebViewController
的ViewModel
, 須要配合着使用:
@property (nonatomic, weak, readonly) CLWebViewController *cl_webViewController;
- (instancetype)initWebViewModelWithController:(CLWebViewController *)controller;
複製代碼
針對UIKit
的UIApplication
進行系統外的方法補充:
+ (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;
複製代碼
針對UIKit
的UIButton
進行系統外的方法補充:
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 - 倒計時方法
- (void)cl_starButtonWithTime:(NSInteger)time
complete:(CLButtonStar)complete;
#pragma mark - 添加UIButton點擊方法
- (void)cl_addButtonActionComplete:(CLButtonAction)complete;
#pragma mark - 用UIActivityIndicatorView代替文字
- (void)cl_showActivityIndicatorViewWithStyle:(UIActivityIndicatorViewStyle)style;
- (void)cl_hideActivityIndicatorView;
#pragma mark - 設置UIButton圖片
- (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 - 設置UIButton背景圖片
- (void)cl_setNormalButtonBackgroundImageWithImage:(UIImage *)image;
- (void)cl_setHighlightedButtonBackgroundImageWithImage:(UIImage *)image;
- (void)cl_setSelectedButtonBackgroundImageWithImage:(UIImage *)image;
- (void)cl_setDisabledButtonBackgroundImageWithImage:(UIImage *)image;
#pragma mark - 獲取UIButton的圖片
- (UIImage *)cl_getNormalButtonImage;
- (UIImage *)cl_getHighlightedButtonImage;
- (UIImage *)cl_getSelectedButtonImage;
- (UIImage *)cl_getDisabledButtonImage;
#pragma mark - 獲取UIButton的背景圖片
- (UIImage *)cl_getNormalButtonBackgroundImage;
- (UIImage *)cl_getHighlightedButtonBackgroundImage;
- (UIImage *)cl_getSelectedButtonBackgroundImage;
- (UIImage *)cl_getDisabledButtonBackgroundImage;
#pragma mark - 設置UIButton標題
- (void)cl_setNormalButtonWithTitle:(NSString *)title;
- (void)cl_setHighlightedButtonWithTitle:(NSString *)title;
- (void)cl_setSelectedButtonWithTitle:(NSString *)title;
- (void)cl_setDisabledButtonWithTitle:(NSString *)title;
#pragma mark - 獲取UIButton標題
- (NSString *)cl_getNormalButtonTitle;
- (NSString *)cl_getHighlightedButtonTitle;
- (NSString *)cl_getSelectedButtonTitle;
- (NSString *)cl_getDisabledButtonTitle;
#pragma mark - 設置UIButton標題
- (void)cl_setNormalTitleWithColor:(UIColor *)color;
- (void)cl_setHighlightedTitleWithColor:(UIColor *)color;
- (void)cl_setSelectedTitleWithColor:(UIColor *)color;
- (void)cl_setDisabledTitleWithColor:(UIColor *)color;
#pragma mark - 獲取UIButton標題顏色
- (UIColor *)cl_getNormalButtonTitleColor;
- (UIColor *)cl_getHighlightedButtonTitleColor;
- (UIColor *)cl_getSelectedButtonTitleColor;
- (UIColor *)cl_getDisabledButtonTitleColor;
#pragma mark - 設置UIButton的NSAttributedString標題
- (void)cl_setNormalButtonWithAttributedStringTitle:(NSAttributedString *)attributedString;
- (void)cl_setHighlightedButtonWithAttributedStringTitle:(NSAttributedString *)attributedString;
- (void)cl_setSelectedButtonWithAttributedStringTitle:(NSAttributedString *)attributedString;
- (void)cl_setDisabledButtonWithAttributedStringTitle:(NSAttributedString *)attributedString;
#pragma mark - 獲取UIButton標題
- (NSAttributedString *)cl_getNormalButtonAttributedStringTitle;
- (NSAttributedString *)cl_getHighlightedButtonAttributedStringTitle;
- (NSAttributedString *)cl_getSelectedButtonAttributedStringTitle;
- (NSAttributedString *)cl_getDisabledButtonAttributedStringTitle;
複製代碼
針對UIKit
的UICollectionView
進行系統外的方法補充:
@protocol CLCollectionViewPlaceholderDelegate <NSObject>
@required
- (UIView *)cl_placeholderView;
@optional
- (BOOL)cl_scrollEnabledWithShowPlaceholderView;
@end
複製代碼
- (void)cl_reloadData;
- (void)cl_removePlaceholderViewWithSuperView;
複製代碼
針對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;
複製代碼
針對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
複製代碼
針對UIKit
的UIDevice
進行系統外的方法補充:
+ (NSString *)cl_getSystemVersion;
+ (NSString *)cl_getDeviceName;
+ (NSString *)cl_getDeviceModelType;
+ (NSString *)cl_getUUIDString;
+ (NSString *)cl_getCurrentDeviceModelName;
+ (BOOL)cl_isPad;
+ (BOOL)cl_isSimulator;
+ (BOOL)cl_isJailbroken;
複製代碼
+ (NSUInteger)cl_getCurrentDeviceCPUCount;
+ (CGFloat)cl_getCurrentDeviceAllCoreCPUUse;
+ (NSArray *)cl_getCurrentDeviceSingleCoreCPUUse;
複製代碼
+ (NSString *)cl_getCarrierName;
+ (NSString *)cl_getCurrentRadioAccessTechnology;
+ (NSString *)cl_getCurrentDeviceIPAddresses;
+ (NSString *)cl_getCurrentDeviceIPAddressWithWiFi;
+ (NSString *)cl_getCurrentDeviceIPAddressWithCell;
複製代碼
+ (int64_t)cl_getDiskSpace;
+ (int64_t)cl_getDiskSpaceFree;
+ (int64_t)cl_getDiskSpaceUsed;
複製代碼
+ (int64_t)cl_getMemoryTotal;
+ (int64_t)cl_getMemoryFree;
+ (int64_t)cl_getMemoryActive;
+ (int64_t)cl_getMemoryInactive;
+ (int64_t)cl_getMemoryWired;
+ (int64_t)cl_getMemoryPurgable;
複製代碼
針對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;
複製代碼
針對UIKit
的UIImage
進行系統外的方法補充:
+ (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;
複製代碼
+ (UIImage *)cl_getImageForView:(UIView *)view;
複製代碼
+ (void)cl_asyncDrawImageToSize:(CGSize)size
image:(UIImage *)image
completion:(CLImage)completion;
複製代碼
+ (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;
複製代碼
+ (void)cl_asyncCreateQRCodeImageWithString:(NSString *)string
completion:(CLImage)completion;
+ (void)cl_asyncCreateQRCodeImageWithString:(NSString *)string
logoImage:(UIImage *)logoImage
completion:(CLImage)completion;
複製代碼
+ (void)cl_asyncCreate128BarcodeImageWithString:(NSString *)string
completion:(CLImage)completion;
+ (void)cl_asyncCreate128BarcodeImageWithString:(NSString *)string
imageSpace:(CGFloat)imageSpace
completion:(CLImage)completion;
複製代碼
+ (UIImage *)cl_getImageWithBundleName:(NSString *)bundle
imageName:(NSString *)imageName;
+ (void)cl_asyncGetVideoPreViewImageWithVideoURL:(NSURL *)videoURL
completion:(CLImage)completion;
複製代碼
+ (void)cl_asyncBlurImageWithBlur:(CGFloat)blur
image:(UIImage *)image
completion:(CLImage)completion;
複製代碼
+ (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;
複製代碼
+ (void)cl_resetSizeWithImage:(UIImage *)image
size:(CGSize)size
completion:(CLImage)completion;
+ (CGSize)cl_getScaleImageWithImage:(UIImage *)image
length:(CGFloat)length;
複製代碼
針對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;
複製代碼
針對UIKit
的UINavigationItem
進行系統外的方法補充:
這裏沒有提供外部的API, 內部實如今iOS 11以前修改UINavigationBar backItem的標題, 若是不須要修改的話, 請在CLUIKit.h文件註釋#import "UINavigationItem+CLNavigationItem.h"
針對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;
複製代碼
針對UIKit
的UIScrollView
進行系統外的方法補充:
- (void)cl_scrollViewToTopWithAnimated:(BOOL)animated;
- (void)cl_scrollViewToLeftWithAnimated:(BOOL)animated;
- (void)cl_scrollViewToBottomWithAnimated:(BOOL)animated;
- (void)cl_scrollViewToRightWithAnimated:(BOOL)animated;
複製代碼
針對UIKit
的UITableView
進行系統外的方法補充:
@protocol CLTableViewPlaceholderDelegate <NSObject>
@required
- (UIView *)cl_placeholderView;
@optional
- (BOOL)cl_calculateTableViewHeaderViewFrame;
- (BOOL)cl_scrollEnabledWithShowPlaceholderView;
@end
- (void)cl_removePlaceholderViewWithSuperView;
複製代碼
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;
複製代碼
- (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;
複製代碼
- (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;
複製代碼
- (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;
複製代碼
針對UIKit
的UIView
進行系統外的方法補充:
內部實如今iOS 11修改UINavigationBar backItem的標題, 若是不須要修改的話, 請在CLUIKit.h文件註釋#import "UIView+CLView.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;
複製代碼
針對UIKit
的UIViewController
進行系統外的方法補充:
@protocol CLNavigationControllerBackItemProtocol <NSObject>
@optional
- (BOOL)cl_navigationShouldPopOnBackButton;
@end
複製代碼
- (BOOL)cl_navigationShouldPopOnBackButton;
- (void)cl_setNavigationBarTranslucentWithBOOL:(BOOL)bools;
- (void)cl_setTabBarTranslucentWithBOOL:(BOOL)bools;
#pragma mark - 呼叫手機
- (void)cl_callPhoneWithPhoneNumber:(NSString *)phoneNumber
message:(NSString *)message
titile:(NSString *)title;
#pragma mark - UIAlertController自定義
- (void)cl_showAlertViewControllerWithTitle:(NSString *)title
message:(NSString *)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;
複製代碼