iOS 福利来了,方便开发的工具库集合

3,783 阅读18分钟

前言

  • 花了半天时间整理我平时用的工具库,详细介绍每个方法属性
  • 机器猫工具库,就像机器猫的口袋一样有无穷无尽意想不到的的各种道具供我们使用

功能介绍

本库主要包含几大板块:UIKit类、Foundation类、Language 多语言类、Classes 粒子效果相关、Control 自定义控件

  • UIButton:图文混排、点击事件封装、扩大点击域、时间间隔限制、倒计时、点击粒子效果等
  • UIView:手势封装、圆角渐变、Xib属性,基础动画封装等
  • UITextView:输入框扩展、限制字数、撤销处理、获取文本内部超链接
  • UITextField:占位颜色,线条,图文处理等
  • UILabel:富文本,快捷显示文本位置
  • UIImage:截图和裁剪、图片压缩、蒙版处理,图片拼接、图片尺寸处理,滤镜渲染、泛洪算法等
  • UIImage:二维码、条形码生成,动态图播放,水印处理等等
  • Runtime:列表,方法交换,动态继承等
  • UIDevice:系统相关属性,
  • Language:多语言,支持Xib快捷设置
  • Foundation:数组和字典防崩处理,数组算法处理,谓词相关,加密解密等等
  • 图片处理封装,霍夫矫正,特征提取,形态学处理,滤镜处理等等

Foundation我还整理封装异常处理Crash防护 Foggy

Cocoapods安装

UIKit模块安装

pod 'KJCategories'

Foundation模块安装

pod 'KJCategories/Foundation'

多语音模块

pod 'KJCategories/Language' # 多语言

Opencv图片模块

该模块需要引入OpenCV库

pod 'OpencvQueen'

粒子效果模块

pod 'KJCategories/Classes'  # 粒子效果相关

自定义控件模块

pod 'KJCategories/Control'  # 自定义控件

目录

关于类型说明

Property:属性
Class & Property:类属性
Protocol:协议
Instance:实例方法
Class:类方法
Function:函数

UIView

UIView+KJAnimation 简单动画效果链式封装

功能类型API & Property
隐式动画Instancekj_animationImplicitDuration:animations:
移动时刻显示阴影效果Instancekj_movingShadow
动画组Instancekj_animationMoreAnimations:
旋转动画效果Instancekj_animationRotateClockwise:makeParameter:
移动动画效果Instancekj_animationMovePoint:makeParameter:
缩放动画效果Instancekj_animationZoomMultiple:makeParameter:
渐隐动画效果Instancekj_animationOpacity:makeParameter:

UIView+KJXib

功能类型API & Property
贝塞尔圆角PropertybezierRadius
阴影偏移量PropertyshadowOffset
阴影透明度PropertyshadowOpacity
阴影的宽度PropertyshadowWidth
阴影的圆角PropertyshadowRadius
阴影颜色PropertyshadowColor
圆角半径PropertycornerRadius
边框宽度PropertyborderWidth
边框颜色PropertyborderColor
图片属性PropertyviewImage
判断是否有子视图在滚动PropertyanySubViewScrolling
判断是否有子视图在滚动Instancekj_anySubViewScrolling
判断控件是否显示在主窗口PropertyshowKeyWindow
判断控件是否显示在主窗口Instancekj_isShowingOnKeyWindow
顶部控制器PropertytopViewController
当前的控制器PropertyviewController
当前的控制器Instancekj_currentViewController
Xib创建的ViewClasskj_viewFromXib
Xib创建的ViewClasskj_viewFromXibWithFrame:

UIView+KJRectCorner 进阶版圆角和边框扩展

功能类型API & Property
圆角半径Propertykj_radius
圆角方位Propertykj_rectCorner
边框颜色Propertykj_borderColor
边框宽度Propertykj_borderWidth
边框方位Propertykj_borderOrientation

UIView+KJGradient 渐变处理 和 指定图形

功能类型API & Property
返回渐变layerInstancekj_GradientLayerWithColors:Frame:Locations:StartPoint:EndPoint:
生成渐变背景色Instancekj_GradientBgColorWithColors:Locations:StartPoint:EndPoint:
虚线边框Instancekj_DashedLineColor:lineWidth:spaceAry:
画直线Instancekj_DrawLineWithPoint:toPoint:lineColor:lineWidth:
画虚线Instancekj_DrawDashLineWithPoint:toPoint:lineColor:lineWidth:lineSpace:lineType:
画五角星Instancekj_DrawPentagramWithCenter:radius:color:rate:
根据宽高画六边形Instancekj_DrawSexangleWithWidth:LineWidth:StrokeColor:FillColor:
根据宽高画八边形Instancekj_DrawOctagonWithWidth:Height:LineWidth:StrokeColor:FillColor:Px:Py:

UIView+KJGestureBlock 手势Block

功能类型API & Property
单击手势Instancekj_AddTapGestureRecognizerBlock:
手势处理Instancekj_AddGestureRecognizer:block:

UIView+KJFrame 轻量级布局

功能类型API & Property
大小Propertysize
位置Propertyorigin
x坐标Propertyx
y坐标Propertyy
宽度Propertywidth
高度Propertyheight
中心点xPropertycenterX
中心点yPropertycenterY
左边距离Propertyleft
右边距离Propertyright
顶部距离Propertytop
底部距离Propertybottom
x + widthPropertymaxX
y + heightPropertymaxY
Masonry布局后xPropertymasonry_x
Masonry布局后yPropertymasonry_y
Masonry布局后宽度Propertymasonry_width
Masonry布局后高度Propertymasonry_height
将视图中心置于其父视图Instancekj_centerToSuperview
距父视图右边距离Instancekj_rightToSuperview:
距父视图下边距离Instancekj_bottomToSuperview:
获取子视图的最高YInstancekj_subviewMaxY
获取子视图的最高XInstancekj_subviewMaxX
寻找子视图Instancekj_FindSubviewRecursively:
移除所有子视图Instancekj_removeAllSubviews
隐藏/显示所有子视图Instancekj_hideSubviews:operation:
子控件处理手势事件Instancekj_childHitTest:withEvent:

UITextView

UITextView+KJBackout 撤销处理,相当于 command + z

功能类型API & Property
是否开启撤销功能PropertykOpenBackout
撤销输入Instancekj_textViewBackout

UITextView+KJPlaceHolder

功能类型API & Property
占位符文字PropertyplaceHolder
占位符LabelPropertyplaceHolderLabel

UITextView+KJLimitCounter 限制处理

功能类型API & Property
限制字数PropertylimitCount
限制区域右边距PropertylimitMargin
限制区域高度PropertylimitHeight
统计限制字数LabelPropertylimitLabel

UITextView+KJHyperlink 超链接点击处理

功能类型API & Property
识别点击TextView里面的超链接网址地址Instancekj_clickTextViewURLCustom:URLHyperlink:

UITextField

UITextField+KJExtension 输入框扩展,快速设置账号密码框

功能类型API & Property
设置底部边框线条颜色PropertybottomLineColor
占位placeholder颜色PropertyplaceholderColor
占位文字字体大小PropertyplaceholderFontSize
最大长度PropertymaxLength
明文暗文切换PropertysecurePasswords
达到最大字符长度PropertykMaxLengthBolck
文本编辑时刻回调PropertykTextEditingChangedBolck
设置左边视图,类似账号密码标题Instancekj_leftView:
设置右边视图,类似小圆叉Instancekj_rightViewTapBlock:ImageName:Width:Padding:

UITabBar

UITabBar+KJBadge 显示小红点

功能类型API & Property
当前的TabBar个数Protocolkj_tabBarCount:
显示小红点Instancekj_showRedBadgeOnItemIndex:
隐藏小红点Instancekj_hideRedBadgeOnItemIndex:

UISlider

KJColorSlider 渐变色滑块

功能类型API & Property
颜色数组Propertycolors
每个颜色对应的位置信息Propertylocations
颜色的高度PropertycolorHeight
边框宽度PropertyborderWidth
边框颜色PropertyborderColor
回调处理时间PropertytimeSpan
当前进度,用于外界kvoPropertyprogress
移动回调处理PropertykValueChangeBlock
移动结束回调处理PropertykMoveEndBlock
重新设置UIInstancekj_setUI

UISlider+KJTapValue 滑杆点击改值

功能类型API & Property
是否开启滑杆点击修改值PropertykTapValue

UIScrollView

UIScrollView+KJEmptyDataSet DZNEmptyDataSet 基础上再次封装没数据时状态

功能类型API & Property
是否正在加载Propertyloading
视图的垂直位置PropertyverticalOffset
空数据图片名PropertyloadedImageName
空数据详情信息PropertydescriptionText
刷新按钮文字PropertykLoadedButton
加载时刻展示的视图PropertykLoadingContentView
刷新按钮点击事件PropertykLoadedButtonClick
其他视图点击事件PropertykLoadedOtherViewClick

UIResponder

UIResponder+KJChain 响应链处理

功能类型API & Property
响应链详情PropertykChainDescription
第一响应者PropertykFirstResponder
Instancekj_responderWithClass:
Instancekj_responderSendAction:Sender:

UIResponder+KJAdapt 简单的屏幕比例适配

功能类型API & Property
设计图机型Protocolkj_adaptModelType:
水平比例适配FunctionKJAdaptScaleLevel
竖直比例适配FunctionKJAdaptScaleVertical
适配CGpointFunctionKJAdaptPointMake
适配CGSizeFunctionKJAdaptSizeMake
适配CGRectFunctionKJAdaptRectMake
适配UIEdgeInsetsFunctionKJAdaptEdgeInsetsMake

UINavigation

UINavigationBar+KJExtension

功能类型API & Property
设置navigationBar背景颜色Propertykj_BackgroundColor
设置基础的透明度Propertykj_Alpha
Propertykj_TranslationY
重置Instancekj_reset

UINavigationItem+KJExtension Item链式生成

功能类型API & Property
链式生成Instancekj_makeNavigationItem:
ExtendParameterBlock 扩展参数PropertykAddBarButtonItemInfo
ExtendParameterBlock 扩展参数PropertykAddLeftBarButtonItem
ExtendParameterBlock 扩展参数PropertykAddRightBarButtonItem

UILabel

UILabel+KJCopy UILabel添加长按复制功能

功能类型API & Property
是否可以拷贝Propertycopyable
移除拷贝长按手势Instancekj_removeCopyLongPressGestureRecognizer

UILabel+KJExtension 文本位置和尺寸获取

功能类型API & Property
设置文字内容显示位置PropertycustomTextAlignment
获取宽度Instancekj_calculateWidth
获取高度Instancekj_calculateHeightWithWidth:
获取高度,指定行高Instancekj_calculateHeightWithWidth:OneLineHeight:
获取文字尺寸Classkj_calculateLabelSizeWithTitle:font:constrainedToSize:lineBreakMode:

UILabel+KJCreate 快速创建文本

功能类型API & Property
快速创建文本Classkj_createLabel:

UILabel+KJAttributedString 富文本

功能类型API & Property
Range之间文字行间距Instancekj_AttributedStringTextLineSpace:
Range之间文字大小Instancekj_AttributedStringTextFont:Range:
Range之间文字颜色Instancekj_AttributedStringTextColor:Range:
Range之间文字大小和颜色Instancekj_AttributedStringTextFont:TextColor:Range:
Range之间文字相关属性Instancekj_AttributedStringTextAttributes:Range:
富文本文字大小Instancekj_AttributedStringTextFont:Loc:Len:
富文本文字颜色Instancekj_AttributedStringTextColor:Loc:Len:
富文本文字大小和颜色Instancekj_AttributedStringTextFont:TextColor:Loc:Len:
富文本文字相关属性Instancekj_AttributedStringTextAttributes:Loc:Len:

UIImageView

UIImageView+KJBlur 模糊处理(高斯模糊、Accelerate模糊、毛玻璃、蒙版)

功能类型API & Property
模糊处理Instancekj_blurImageViewWithBlurType:BlurImage:BlurRadius:

UIImageView+KJLetters 文字头像,首字母缩略头像

功能类型API & Property
显示文字图片Instancekj_imageViewWithText:LettersInfo:
浏览头像,点击全屏展示Instancekj_headerImageShowScreen
浏览头像,背景颜色Instancekj_headerImageShowScreenWithBackground:

UIImage

UIImage+KJQRCode 二维码/条形码生成器,特别备注文字不能是中文汉字

功能类型API & Property
将字符串转成条形码Classkj_barCodeImageWithContent:
生成二维码Classkj_QRCodeImageWithContent:codeImageSize:
生成指定颜色二维码Classkj_QRCodeImageWithContent:codeImageSize:color:
生成条形码Classkj_barcodeImageWithContent:codeImageSize:
生成指定颜色条形码Classkj_barcodeImageWithContent:codeImageSize:color:
改变图片尺寸,bitmap方式Instancekj_bitmapChangeImageSize:
改变图片内部像素颜色Instancekj_changeImagePixelColor:

UIImage+KJURLSize 获取网络图片尺寸

功能类型API & Property
获取网络图片尺寸Classkj_imageGetSizeWithURL:
异步等待获取网络图片大小,信号量Classkj_imageAsyncGetSizeWithURL:

UIImage+KJScale 图片尺寸处理

功能类型API & Property
通过比例来缩放图片Instancekj_scaleImage:
以固定宽度缩放图像Instancekj_scaleWithFixedWidth:
以固定高度缩放图像Instancekj_scaleWithFixedHeight:
等比改变图片尺寸Instancekj_cropImageWithAnySize:
等比缩小图片尺寸Instancekj_zoomImageWithMaxSize:
不拉升填充图片Instancekj_fitImageWithSize:

UIImage+KJPhotoshop

功能类型API & Property
获取图片平均颜色Instancekj_getImageAverageColor
获得灰度图Instancekj_getGrayImage
改变图片透明度Instancekj_changeImageAlpha:
改变图片背景颜色Instancekj_changeImageColor:
修改图片线条颜色Instancekj_imageLinellaeColor:
图层混合Instancekj_imageBlendMode:TineColor:

UIImage+KJMask 蒙版处理,图片拼接

功能类型API & Property
文字水印Instancekj_waterText:direction:textColor:font:margin:
图片水印Instancekj_waterImage:direction:waterSize:margin:
图片添加水印Instancekj_waterMark:InRect:
蒙版图片处理Instancekj_maskImage:
圆形图片Instancekj_circleImage
椭圆形图片Instancekj_ellipseImage
图片透明区域点击穿透处理Instancekj_transparentWithPoint:

UIImage+KJJoint 图片拼接相关处理

功能类型API & Property
旋转图片和镜像处理Instancekj_rotationImageWithOrientation:
竖直方向拼接随意张图片,固定主图的宽度Instancekj_moreJointVerticalImage:
水平方向拼接随意张图片,固定主图的高度Instancekj_moreJointLevelImage:
图片多次合成处理Instancekj_imageCompoundWithLoopNums:Orientation:
水平方向拼接随意张图片,固定主图的高度Instancekj_moreAccelerateJointLevelImage:
图片拼接艺术Instancekj_jointImageWithJointType:Size:Maxw:
进阶版图片拼接艺术,待完善Instancekj_jointImageWithAdvanceJointType:Size:Maxw:Parameter:

UIImage+KJGIF 播放动态图

功能类型API & Property
本地动态图播放Classkj_gifLocalityImageWithName:
本地动图Classkj_gifImageWithData:
网络动图Classkj_gifImageWithURL:

UIImage+KJFloodFill 基于扫描线的泛洪算法,获取填充同颜色区域后的图片

功能类型API & Property
填充图片Instancekj_FloodFillImageFromStartPoint:NewColor:Tolerance:UseAntialias:

UIImage+CoreImage CoreImage框架整理

功能类型API & Property
Photoshop滤镜Instancekj_coreImagePhotoshopWithType:Value:
通用方法Instancekj_coreImageCustomWithName:Dicts:
高光和阴影Instancekj_coreImageHighlightShadowWithHighlightAmount:ShadowAmount:
将图片黑色变透明Instancekj_coreImageBlackMaskToAlpha
马赛克Instancekj_coreImagePixellateWithCenter:Scale:
图片圆形变形Instancekj_coreImageCircularWrapWithCenter:Radius:Angle:
环形透镜畸变Instancekj_coreImageTorusLensDistortionCenter:Radius:Width:Refraction:
空变形Instancekj_coreImageHoleDistortionCenter:Radius:
应用透视校正Instancekj_coreImagePerspectiveCorrectionWithTopLeft:TopRight:BottomRight:BottomLeft:
透视变换Instancekj_coreImagePerspectiveTransformWithTopLeft:TopRight:BottomRight:BottomLeft:
软装专属透视Instancekj_softFitmentFluoroscopyWithTopLeft:TopRight:BottomRight:BottomLeft:

UIImage+KJCompress 图片压缩处理,提供几种系统API的处理方式

功能类型API & Property
压缩图片到指定大小Instancekj_compressTargetByte:
压缩图片到指定大小Classkj_compressImage:TargetByte:
UIKit方式Instancekj_UIKitChangeImageSize:
Quartz 2DInstancekj_QuartzChangeImageSize:
ImageIOInstancekj_ImageIOChangeImageSize:
CoreImageInstancekj_CoreImageChangeImageSize:
AccelerateInstancekj_AccelerateChangeImageSize:

UIImage+KJCapture 截图和裁剪处理

功能类型API & Property
当前视图截图Classkj_captureScreen:
指定位置屏幕截图Classkj_captureScreen:Rect:
自定义质量的截图,quality质量倍数Classkj_captureScreen:Rect:Quality:
截取当前屏幕(窗口截图)Classkj_captureScreenWindow
截取当前屏幕(根据手机方向旋转)Classkj_captureScreenWindowForInterfaceOrientation
截取滚动视图的长图Classkj_captureScreenWithScrollView:ContentOffset:
裁剪掉图片周围的透明部分Classkj_cutImageRoundAlphaZero:
不规则图形切图Classkj_anomalyCaptureImageWithView:BezierPath:
多边形切图Classkj_polygonCaptureImageWithImageView:PointArray:
指定区域裁剪Classkj_cutImageWithImage:Frame:
quartz 2d 实现裁剪Classkj_quartzCutImageWithImage:Frame:
图片路径裁剪,裁剪路径 "以外" 部分Classkj_captureOuterImage:BezierPath:Rect:
图片路径裁剪,裁剪路径 "以内" 部分Classkj_captureInnerImage:BezierPath:Rect:

UIImage+KJAccelerate Accelerate 框架的图片处理

功能类型API & Property
图片旋转Instancekj_rotateInRadians:
模糊处理Instancekj_blurImageSoft
模糊处理Instancekj_blurImageLight
模糊处理Instancekj_blurImageExtraLight
模糊处理Instancekj_blurImageDark
指定颜色线性模糊Instancekj_blurImageWithTintColor:
线性模糊,保留透明区域Instancekj_linearBlurryImageBlur:
模糊处理Instancekj_blurImageWithRadius:Color:MaskImage:
均衡运算Instancekj_equalizationImage
侵蚀Instancekj_erodeImage
形态膨胀/扩张Instancekj_dilateImage
多倍侵蚀Instancekj_erodeImageWithIterations:
形态多倍膨胀/扩张Instancekj_dilateImageWithIterations:
梯度Instancekj_gradientImageWithIterations:
顶帽运算Instancekj_tophatImageWithIterations:
黑帽运算Instancekj_blackhatImageWithIterations:
卷积处理Instancekj_convolutionImageWithKernel:
锐化Instancekj_sharpenImage
锐化Instancekj_sharpenImageWithIterations:
浮雕Instancekj_embossImage
高斯Instancekj_gaussianImage
边缘检测Instancekj_marginImage
边缘检测Instancekj_edgeDetection

UIDevice

UIDevice+KJSystem 系统相关的操作

功能类型API & Property
App版本号Class & PropertyappCurrentVersion
App名称Class & PropertyappName
手机UUIDClass & PropertydeviceID
获取App图标Class & PropertyappIcon
判断App是否支持横屏Class & PropertysupportHorizontalScreen
获取启动页图片Class & PropertylaunchImage
系统启动图缓存路径Class & PropertylaunchImageCachePath
启动图备份文件路径Class & PropertylaunchImageBackupPath
生成启动图Classkj_launchImageWithPortrait:Dark:
生成启动图Classkj_launchImageWithStoryboard:Portrait:Dark:
对比版本号Classkj_comparisonVersion:
获取AppStore版本号和详情信息Classkj_getAppStoreVersionWithAppid:Details:
跳转到指定URLClasskj_openURL:
调用AppStoreClasskj_skipToAppStoreWithAppid:
调用自带浏览器safariClasskj_skipToSafari
调用自带MailClasskj_skipToMail
是否切换为扬声器Classkj_changeLoudspeaker:
保存到相册Classkj_savedPhotosAlbumWithImage:Complete:
系统自带分享Classkj_shareActivityWithItems:ViewController:Complete:
切换根视图控制器Classkj_changeRootViewController:Complete:

UIControl

UISegmentedControl+KJCustom

功能类型API & Property
解决修改背景色和文字颜色Instancekj_ensureBackgroundAndTintColor:

UIColor

UIColor+KJExtension 颜色相关扩展

功能类型API & Property
渐变颜色Classzj_gradientColorWithColors:GradientType:Size:
竖直渐变颜色Instancekj_gradientVerticalToColor:Height:
横向渐变颜色Instancekj_gradientAcrossToColor:Width:
生成附带边框的渐变色图片Classkj_colorImageWithColors:locations: size:borderWidth:borderColor:
UIColor转16进制字符串Classkj_hexStringFromColor:
16进制字符串转UIColorClasskj_colorWithHexString:
获取图片上指定点的颜色Classkj_colorAtImage:Point:
获取ImageView上指定点的图片颜色Classkj_colorAtImageView:Point:

UIColor+KJExtension2 颜色相关扩展

功能类型API & Property
Propertyred
Propertygreen
Propertyblue
Propertyalpha
色相Propertyhue
饱和度Propertysaturation
亮度Propertylight
获取颜色对应的RGBAInstancekj_colorGetRGBA
获取颜色对应的色相饱和度和透明度Instancekj_colorGetHSL
获取颜色的均值Classkj_averageColors:

UIButton

UIButton+KJBlock 点击事件ButtonBlock

功能类型API & Property
是否开启时间间隔的方法交换Protocolkj_openTimeExchangeMethod
添加点击事件Instancekj_addAction:
添加事件,不支持多枚举形式Instancekj_addAction:forControlEvents:
点击事件间隔PropertytimeInterval

UIButton+KJContentLayout 图文混排(支持XIB显示)

功能类型API & Property
图文样式PropertylayoutType
图文间距Propertypadding
图文边界的间距Propertyperiphery
图文样式Propertykj_ButtonContentLayoutType
图文间距Propertykj_Padding
图文边界的间距Propertykj_PaddingInset

UIButton+KJCountDown 倒计时

功能类型API & Property
倒计时结束的回调PropertykButtonCountDownStop
设置倒计时的间隔和倒计时文案Instancekj_startTime:CountDownFormat:
取消倒计时Instancekj_cancelTimer

UIButton+KJCreate 按钮快速创建

功能类型API & Property
创建图片按钮Classkj_createButton:

UIButton+KJEmitter 按钮粒子效果

功能类型API & Property
是否开启粒子效果PropertyopenEmitter
粒子,备注 name 属性不要更改PropertyemitterCell
设置粒子效果Instancekj_buttonSetEmitterImage:OpenEmitter:

UIButton+KJEnlarge 改变UIButton的响应区域 - 扩大Button点击域

功能类型API & Property
设置按钮额外热区PropertytouchAreaInsets
扩大点击域Instancekj_EnlargeEdgeWithTop:right:bottom:left:

UIButton+KJIndicator 指示器(系统自带菊花)

功能类型API & Property
按钮是否正在提交中Propertysubmitting
指示器和文字间隔PropertyindicatorSpace
指示器颜色PropertyindicatorType
开始提交,指示器跟随文字Instancekj_beginSubmitting:
结束提交Instancekj_endSubmitting
显示指示器Instancekj_showIndicator
隐藏指示器Instancekj_hideIndicator

UICollectionView

UICollectionView+KJTouch 获取touch事件处理

功能类型API & Property
开启方法交换PropertykOpenExchange
Touch里面移动回调Propertymoveblock

UIBezierPath

UIBezierPath+KJPoints 获取贝塞尔曲线上面的点

功能类型API & Property
获取所有点Propertypoints
获取文字贝塞尔路径Classkj_bezierPathWithText:Font:

NSObject

KJGeometry 几何方程式相关

功能类型API & Property
已知A、B两点和C点到B点的长度,求垂直AB的C点Classkj_perpendicularLineDotsWithA:B:Len:Positive:
已知A、B两点和C点到B点的长度,求垂直AB的C点Classkj_perpendicularLineDotsWithA:B:Length:
已知A、B、C、D 4个点,求AB与CD交点Classkj_linellaeCrosspointWithA:B:C:D:
求两点线段长度Classkj_distanceBetweenPointsWithA:B:
已知A、B、C三个点,求AB线对应C的平行线上的点Classkj_parallelLineDotsWithA:B:C:
椭圆求点方程Classkj_ovalPointWithRect:Angle:

KJMathEquation 数学算法方程式

功能类型API & Property
把弧度转换成角度Classkj_degreeFromRadian:
把角度转换成弧度Classkj_radianFromDegree:
正切函数的弧度值,tanClasskj_radianValueFromTanSideA:sideB:
获取具有固定宽度的新sizeClasskj_resetFromSize:FixedWidth:
获取具有固定高度的新sizeClasskj_resetFromSize:FixedHeight:
一元一次线性方程,求k,bClasskj_mathOnceLinearEquationWithPointA:PointB:
已知y,k,b 求 xClasskj_xValueWithY:LinearEquation:
已知x,k,b 求 yClasskj_yValueWithX:LinearEquation:

NSObject+KJKVO 键值监听封装,自动释放

功能类型API & Property
kvo监听Instancekj_observeKey:ObserveResultBlock:

NSObject+KJRuntime Runtime轻量级封装

功能类型API & Property
获取该对象的所有属性,包含父类PropertypropertyTemps
实例变量列表PropertyivarTemps
方法列表PropertymethodTemps
遵循的协议列表PropertyprotocolTemps
归档封装Instancekj_encodeRuntime:
解档封装Instancekj_initCoderRuntime:

NSObject+KJSemaphore 轻量级解耦工具(信号)

功能类型API & Property
发送消息处理Instancekj_sendSemaphoreWithKey:Message:Parameter:
接收消息处理Instancekj_receivedSemaphoreBlock:
代码执行时间处理Classkj_executeTime:

NSDictionary

NSDictionary+KJExtension

功能类型API & Property
是否为空PropertyisEmpty
转换为Josn字符串PropertyjsonString

NSString

NSString+KJExtension 字符串扩展属性

功能类型API & Property
是否为空PropertyisEmpty
转换为URLPropertyURL
获取图片Propertyimage
取出HTMLPropertyHTMLString
Josn字符串转字典PropertyjsonDict
生成竖直文字PropertyverticalText
获取文本宽度Instancekj_maxWidthWithFont:Height:Alignment:LinebreakMode:LineSpace:
获取文本高度Instancekj_maxHeightWithFont:Width:Alignment:LinebreakMode:LineSpace:
文字转图片Instancekj_textBecomeImageWithSize:BackgroundColor:TextAttributes:

NSString+KJChinese 汉字相关处理

功能类型API & Property
汉字转拼音PropertypinYin
随机汉字Classkj_randomCreateChinese:
查找数据Instancekj_searchArray:
字母排序Instancekj_letterSortArray:

NSString+KJPredicate 谓词工具

功能类型API & Property
过滤空格Instancekj_filterSpace
验证数字Instancekj_validateNumber
是否有特殊字符Instancekj_validateHaveSpecialCharacter
过滤特殊字符Instancekj_removeSpecialCharacter:
验证手机号码Instancekj_validateMobileNumber
验证邮箱格式Instancekj_validateEmail
验证身份证Instancekj_validateIDCardNumber
验证银行卡Instancekj_validateBankCardNumber

NSString+KJSecurity 加密解密工具,链式处理

功能类型API & Property
生成keyInstancekj_createKey
生成tokenInstancekj_createToken
RSA公钥加密Instancekj_rsaEncryptPublicKey
RSA公钥解密Instancekj_rsaDecryptPublicKey
RSA私钥加密Instancekj_rsaEncryptPrivateKey
RSA私钥解密Instancekj_rsaDecryptPrivateKey
AES加密Instancekj_aesEncryptKey
AES解密Instancekj_aesDecryptKey
Base64编码Instancekj_base64EncodedString
Base64解码Instancekj_base64DecodingString

NSTimer

NSTimer+KJExtension

功能类型API & Property
当前线程计时器Classkj_scheduledTimerWithTimeInterval:Repeats:Block:
当前线程Classkj_scheduledTimerWithTimeInterval:Repeats:Block:RunLoopMode:
线程计时器Classkj_timerWithTimeInterval:Repeats:Block:
立刻执行Instancekj_immediatelyTimer
暂停Instancekj_pauseTimer
重启计时器Instancekj_resumeTimer
延时执行Instancekj_resumeTimerAfterTimeInterval:
释放计时器Classkj_invalidateTimer:

NSArray

NSArray+KJPredicate 谓词工具

功能类型API & Property
对比两个数组删除相同元素并合并Instancekj_mergeArrayAndDelEqualObjWithOtherArray:
过滤数组Instancekj_filtrationDatasWithPredicateBlock:
除去数组当中包含目标数组的数据Instancekj_delEqualDatasWithTargetTemps:
按照某一属性的升序降序排列Instancekj_sortDescriptorWithKey:Ascending:
按照某些属性的升序降序排列Instancekj_sortDescriptorWithKeys:Ascendings:
取出 key 中匹配 value 的元素Instancekj_takeOutDatasWithKey:Value:
字符串比较运算符Instancekj_takeOutDatasWithOperator:Key:Value:

NSArray+KJExtension 对数组里面元素的相关处理

功能类型API & Property
是否为空PropertyisEmpty
筛选数据Instancekj_detectArray:
多维数组筛选数据Instancekj_detectManyDimensionArray:
查找数据Instancekj_searchObject:
映射Instancekj_mapArray:
插入数据到目的位置Instancekj_insertObject:
数组计算交集Instancekj_arrayIntersectionWithOtherArray:
数组计算差集Instancekj_arrayMinusWithOtherArray:
随机打乱数组Instancekj_disorganizeArray
删除数组当中的相同元素Instancekj_delArrayEquelObj
生成一组不重复的随机数Instancekj_noRepeatRandomArrayWithMinNum:maxNum:count:
二分查找Instancekj_binarySearchTarget:
冒泡排序Instancekj_bubbleSort
插入排序Instancekj_insertSort
选择排序Instancekj_selectionSort

这个真的是手都复制粘贴痛了,老板们点个星星鼓励一下 - -

Demo地址KJCategories、图文介绍 哆啦A梦工具库介绍

备注:本文用到的部分函数方法和Demo,均来自三方库**KJCategories**,如有需要的朋友可自行pod 'KJCategories'引入即可

功能介绍就到此完毕,后面有相关再补充,写文章不容易,还请点个**小星星**传送门