Skip to content

Collection of native ios extensions and classes to boost development process. Such as UIKit, Foundation, QuartzCore, Accelerate, OpenCV, CoreGraphics, os and more. 超实用开发加速工具库

License

Notifications You must be signed in to change notification settings

yangKJ/KJCategories

Repository files navigation

KJCategories

Carthage compatible Releases Compatible CocoaPods Compatible Platform

Set of Extensions and Custom control for standard types and classes.
Just like Doraemon’s pocket, has an endless variety of props for us to use.

English | 简体中文


  • OpenCV: Hough correction, feature extraction, image processing package, morphological processing, filter processing, photo restoration, etc.
  • NSArray: Related processing of the elements in the array, etc.
  • NSDate: Time transformation, etc.
  • UIButton: Emitter animation, image and text mixing, click event encapsulation, expanded click field, time interval limit, countdown, click particle effect, etc.
  • UIView: Gesture package, rounded corner gradient, Xib attribute, basic animation package, etc.
  • UITextView: Expand the input box, limit the number of words, cancel processing, get the internal hyperlink of the text, etc.
  • UITextField: Placeholder color, line, graphic processing, etc.
  • UILabel: Rich text, fast display text position, etc.
  • UIImage: Screenshot and cropping, image compression, mask processing, image stitching, image size processing, filter rendering, flooding algorithm, etc.
  • UIImage: QR code, barcode generation, dynamic image playback, watermark processing, etc.
  • NSObject: GCD, asynchronous timer, resident thread, thread keep alive, runtime methods, etc.
  • NSString: Hash crypto, mathematical operators, unit conversion, etc.
  • Other: Gradient slider, Open screen particle animation, projection and shadow, etc.
Encapsulation exception Handling FoggyDemo

Contents

Methods and Functions

OpenCV

  • Opencv picture processing.
Description Signatures
Picture Tile kj_opencvTiledRows:cols:
Four-point perspective image based on perspective kj_opencvWarpPerspectiveWithKnownPoints:size:
Eliminate image highlights kj_opencvIlluminationChangeBeta:alpha:
Picture Blending kj_opencvBlendImage:alpha:
Adjust picture brightness and contrast kj_opencvChangeContrast:luminance:
Modify the color of the picture channel value kj_opencvChangeR:g:b:
Blur processing kj_opencvBlurX:y:
Gaussian Blur kj_opencvGaussianBlurX:y:
Median Blur kj_opencvMedianBlurksize:
Gaussian Bilateral Blur kj_opencvBilateralFilterBlurRadio:sigma:
Custom linear blur kj_opencvCustomBlurksize:
Morphology operations kj_opencvMorphology:element:
Remove watermark kj_opencvInpaintImage:
Picture repair, effect enhancement processing kj_opencvRepairImage
Cut out the largest inner rectangular area kj_opencvCutMaxRegionImage
Feature extraction kj_opencvFeatureExtractionFromSobel
Hough line judgment and correction kj_opencvHoughLinesCorrectTextImageFillColor:

back to top

NSArray

  • Related processing of the elements in the array.
Description Signatures
Is it empty isEmpty
Filter data kj_detectArray:
Multidimensional array data kj_detectManyDimensionArray:
Search data kj_searchObject:
Map kj_mapArray:
Insert data to the destination kj_insertObject:
Array calculation intersection kj_arrayIntersectionWithOtherArray:
Array calculation difference kj_arrayMinusWithOtherArray:
Randomly Disorganize Array kj_disorganizeArray
Delete the same element in the array kj_delArrayEquelObj
Binary Search kj_binarySearchTarget:
Bubble Sort kj_bubbleSort
Insert Sort kj_insertSort
Selection Sort kj_selectionSort

back to top

NSDate

  • Time transformation.
Description Signatures
Convert date to local time kj_localeDate
Time string conversion NSDate kj_dateFromString:
Time string to NSDate kj_dateFromString:format:
Get the current timestamp kj_currentTimetampWithMsec:
Timestamp to time kj_timeWithTimestamp:format:
Get the UTC timestamp of the specified time kj_timeStampUTCWithTimeString:

back to top

NSDictionary

  • Dictionary common methods.
Description Signatures
Is it empty isEmpty
Convert to Josn String jsonString
Whether to include a key kj_containsKey:
Dictionary keys in ascending order kj_keysSorted
Dictionary key Description descending order kj_keySortDescending
Quickly traverse the dictionary kj_applyDictionaryValue:
Mapping kj_mapDictionary:
Merge kj_mergeDictionary:
Selector kj_pickForKeys:
Remover kj_omitForKeys:

back to top

UIView

  • Advanced Edition Rounded Corners and Border Extension.
Description Signatures
Bezier Fillet bezierRadius
Shadow Offset shadowOffset
Shadow Opacity shadowOpacity
Shadow Width shadowWidth
Shadow rounded corners shadowRadius
Shadow Color shadowColor
Corner Radius cornerRadius
Border Width borderWidth
Border Color borderColor
Image properties viewImage
Top Controller topViewController
Current Controller viewController
Current Controller kj_currentViewController
View created by Xib kj_viewFromXib
View created by Xib kj_viewFromXibWithFrame:
Fillet radius kj_radius
Rounded corner orientation kj_rectCorner
Border Color kj_borderColor
Border width kj_borderWidth
Border Orientation kj_borderOrientation
Size size
Location origin
x coordinate x
y coordinate y
Width width
Height height
Center point x centerX
Center point y centerY
Left distance left
Right distance right
Top distance top
Bottom distance bottom
x + width maxX
y + height Property
After Masonry layout x masonry_x
After Masonry layout y masonry_y
Masonry width after layout masonry_width
Masonry height after layout masonry_height
Center the view in its parent view kj_centerToSuperview
Distance from the right of the parent view kj_rightToSuperview:
Distance from the bottom of the parent view kj_bottomToSuperview:
Get the highest Y of the subview kj_subviewMaxY
Get the highest X of the subview kj_subviewMaxX
Find Subview kj_FindSubviewRecursively:
Remove all subviews kj_removeAllSubviews
Hide/Show all subviews kj_hideSubviews:operation:
Child controls handle gesture events kj_childHitTest:withEvent:

back to top

UITextView

  • UITextView undo processing, equivalent to command + z, limit processing.
Description Signatures
Whether to enable the undo function kOpenBackout
Cancel input kj_textViewBackout
Placeholder text placeHolder
Placeholder Label placeHolderLabel
Limit word count limitCount
Right margin of restricted area limitMargin
Restricted area height limitHeight
Statistics limit the number of words Label limitLabel

back to top

UITextField

  • UITextField input box extension, placeholder, quick setting account password box.
Description Signatures
Set the bottom border line color bottomLineColor
Placeholder Color placeholderColor
PlaceholderFontSize placeholderFontSize
Maximum Length maxLength
Clear text to dark text switch securePasswords
Maximum character length reached kMaxLengthBolck
Text editing moment callback kTextEditingChangedBolck

back to top

UILabel

  • UILabel add long press copy function, Get text position and size.
Description Signatures
Can copy copyable
Remove copy long press gesture kj_removeCopyLongPressGestureRecognizer
Set the display position of the text content customTextAlignment
Get width kj_calculateWidth
Get height kj_calculateHeightWithWidth:
Get height, specify line height kj_calculateHeightWithWidth:OneLineHeight:
The text line spacing between Ranges kj_AttributedStringTextLineSpace:
Text size between ranges kj_AttributedStringTextFont:Range:
Text color between Ranges kj_AttributedStringTextColor:Range:
Text size and color between Ranges kj_AttributedStringTextFont:TextColor:Range:
Text related attributes between Ranges kj_AttributedStringTextAttributes:Range:
Rich text text size kj_AttributedStringTextFont:Loc:Len:
Rich text text color kj_AttributedStringTextColor:Loc:Len:
Rich text text size and color kj_AttributedStringTextFont:TextColor:Loc:Len:
Rich text related attributes kj_AttributedStringTextAttributes:Loc:Len:

back to top

UIImage

  • QR code and barcode generator, image size, screenshot and crop processing, Picture cropper.
Description Signatures
Convert a string to a barcode kj_barCodeImageWithContent:
Generate QR Code kj_QRCodeImageWithContent:codeImageSize:
Generate QR Code with Specified Color kj_QRCodeImageWithContent:codeImageSize:color:
Generate barcode kj_barcodeImageWithContent:codeImageSize:
Generate barcode with specified color kj_barcodeImageWithContent:codeImageSize:color:
Change the image size, bitmap mode kj_bitmapChangeImageSize:
Change the internal pixel color of the image kj_changeImagePixelColor:
Get network image size kj_imageSizeWithURL:
Scale the image by scale kj_scaleImage:
Scale the image with a fixed width kj_scaleWithFixedWidth:
Scale the image with a fixed height kj_scaleWithFixedHeight:
Change the image size proportionally kj_cropImageWithAnySize:
Reduce the image size proportionally kj_zoomImageWithMaxSize:
Do not pull up the filling image kj_fitImageWithSize:
Screenshot of the current view kj_captureScreen:
Specified location screen capture kj_captureScreen:Rect:
Customized quality screenshots, quality multiples kj_captureScreen:Rect:Quality:
Capture the current screen kj_captureScreenWindow
Capture the long image of the scroll view kj_captureScreenWithScrollView:ContentOffset:
Cut out the transparent part around the picture kj_cutImageRoundAlphaZero:
Irregular graphics cutting kj_anomalyCaptureImageWithView:BezierPath:
Polygon Cut Image kj_polygonCaptureImageWithImageView:PointArray:
Specified area crop kj_cutImageWithImage:Frame:
quartz 2d to achieve cropping kj_quartzCutImageWithImage:Frame:
Image path clipping, clipping path "outside" part kj_captureOuterImage:BezierPath:Rect:
Image path clipping, clipping path "within" part kj_captureInnerImage:BezierPath:Rect:
Picture Rotation kj_rotateInRadians:
Specified color linear blur kj_blurImageWithTintColor:
Linear blur, keep transparent area kj_linearBlurryImageBlur:
Blur processing kj_blurImageWithRadius:Color:MaskImage:
Equalization calculation kj_equalizationImage
Erosion kj_erodeImage
Form expansion kj_dilateImage
Multiple erosion kj_erodeImageWithIterations:
Multiple expansion of form kj_dilateImageWithIterations:
Gradient kj_gradientImageWithIterations:
Top Hat Computing kj_tophatImageWithIterations:
Black Hat Computing kj_blackhatImageWithIterations:
Convolution processing kj_convolutionImageWithKernel:
Sharpen kj_sharpenImage
Relief kj_embossImage
Gauss kj_gaussianImage
Edge Detection kj_marginImage

back to top

UIDevice

  • UIDevice system related operations.
Description Signatures
App version number appCurrentVersion
App Description appName
Mobile UUID deviceID
Get App Icon appIcon
Get launch page image launchImage
System startup map cache path launchImageCachePath
Launch Image Backup File Path launchImageBackupPath
Generate launch image kj_launchImageWithPortrait:Dark:
Generate launch diagram kj_launchImageWithStoryboard:Portrait:Dark:
Comparison version number kj_comparisonVersion:
Jump to the specified URL kj_openURL:
Call AppStore kj_skipToAppStoreWithAppid:
Call the built-in browser safari kj_skipToSafari
Call the built-in Mail kj_skipToMail
Whether to switch to speaker kj_changeLoudspeaker:
Save to Album kj_savedPhotosAlbumWithImage:Complete:
System comes with sharing kj_shareActivityWithItems:ViewController:Complete:
Switch Root View Controller kj_changeRootViewController:Complete:

back to top

UIColor

  • UIColor related extension.
Description Signatures
UIColor to hexadecimal string kj_hexString
Hexadecimal string to UIColor kj_colorWithHexString:
red red
green green
blue blue
alpha alpha
Hue hue
Saturation saturation
Brightness light
Get the RGBA corresponding to the color kj_colorGetRGBA
Get the average value of colors kj_averageColors:
Vertical gradient color kj_gradientVerticalToColor:height:
Horizontal gradient color kj_gradientAcrossToColor:width:
Get the color of a specified point on the image kj_colorAtImage:Point:

back to top

UIButton

  • UIButton click event block, mixed graphics and text, enlarge click.
Description Signatures
Add click event kj_addAction:
Click Event Interval timeInterval
Expand the unified click field enlargeClick
Graphic style layoutType
Picture and text spacing padding
The spacing of the graphic borders periphery
Picture and text spacing kj_contentLayout:padding:
Picture and text spacing kj_contentLayout:padding:periphery:

back to top

UISlider

  • Rainbow gradient color slider.
Description Signatures
Color array colors
Location information corresponding to each color locations
Color height colorHeight
Border Width borderWidth
Border Color borderColor
Callback processing time timeSpan
Current progress, for external kvo progress
Moving block movingWithTimeSpan:withBlock:
Moved block moveEndBlock:
Reset UI updateUI

back to top

UIViewController

  • Switch view controller.
Description Signatures
Jump back to the specified controller kj_popTargetViewController:complete:
Switch Root View Controller kj_changeRootViewController:

back to top

CustomizedControl

  • Primarily encapsulates custom controls.
Description Class
Particle animation effect KJEmitterAnimation
Rainbow gradient slider KJGradientSlider
Drop shadow layer control KJProjectionView
Inner and outer shadow control KJShadowView

back to top

CocoaPods Install

Example import core module:
- pod 'KJCategories'

Example import UIBezierPath:
- pod 'KJCategories/KitExtension/UIBezierPath'

Example import NSArray:
- pod 'KJCategories/Foundation/NSArray'

Example import GradientSlider:
- pod 'KJCategories/Customized/GradientSlider'

About Opencv module

As for Opencv module, I have taken it out separately. Friends who need it can directly introduce OpencvQueen library.

pod 'OpencvQueen'

License

KJCategories is available under the MIT license. See the LICENSE file for more info.

About

Collection of native ios extensions and classes to boost development process. Such as UIKit, Foundation, QuartzCore, Accelerate, OpenCV, CoreGraphics, os and more. 超实用开发加速工具库

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published