Objective-C相关Category的收集

What?

User-driven collection of Cocoa categories. Categories is a way to add functionality to classes that you do not have the source code to.

Apple Documentation: Customizing Existing Classes

Why?

Since I first read about objective-c categories I have, with every new project, increased my usage of this wonderful feature. I wanted more, but good categories were not that easy to find. So I decided to create this site with a vision to gather all the best categories that people create in one place and to help others find them as well.

How?

Use them as you like and feel free to add your own, or anyone elses categories (if they dont mind) to the collection. The main purpose of this site is to spread the knowledge of categories and to create a single place to find the best ones. In future versions you will probably find more advanced filtering, tags and so on but I will take this as the need arises.

Want to get updated? Subscribe to the RSS feed.

Who?

I am Fille Åström, co-founder and developer @ IMGNRY.

Help?

I appreciate all the feedback I can get, and I am very eager to improve this idea in any way possible. If you have anything to say, may it be complaints, suggestions or just nice words, do not hesitate to send me an email on fille@imgnry.com or message @bobmoff on Twitter or App.net


  • UIImageView+FaceAwareFill

    This category applies Aspect Fill content mode to an image and if faces are detected it centers them instead of centering the image just by its geometrical center.

  • NSRegularEx+ObjCRegex

    NSRegularExpression categories that simplify regular expressions in Objective-C

  • UIScrollView+Extensions

    A category on UIScrollView for detecting when content has scrolled to top or bottom.

  • NSObject+AutoCoding

    Provides automatic support for NSCoding and NSCopying

  • NSInvocation+SimpleCreation

    Create invocations the simple way.

  • NSRegularExpression+Concise

    Categories on NSRegularExpression that make regular expressions more concise in Objective-C

  • NSString+SHPersian

    Enables Persian fonts rendering.

  • UILabel+ContentSize

    Calculate the size of the content inside a UILabel

  • UIViewController+Swizzled

    Logs the UIViewController hierarchy including the name of the view controller you are in, plus a representation of how deep you are.

  • NSObject+Association

    Ever dreamed of adding "userInfo" to an UIAlertView? Now you can! This category allows you to assign any object to any object from iOS 3.1 and Mac OS 10.6 and up.

  • NSHTTPCookieStorage+FreezeDry

    Persist UIWebView cookies between app restarts. See GitHub note!

  • UIDevice+Hardware

    Detect hardware version of device

  • NSObject+LogDealloc

    Logs when dealloc is called on the object

  • NSObject+SFObservers

    Expanding both NSNotificationCenter and KVO to provide auto removal of observers

  • UIApplication+NetworkActivity

    UIApplication+NetworkActivity keeps track of how many network operations you currently have and manages the NetworkActivityIndicator for you.

  • UIView+Recursion

    Find a subview recursively

  • UIView+RoundedCorners

    Add rounded corners to any view using layer mask.

  • UIView+Stacker

    Stack subviews vertically ordered by their index. Good when u want to use XIB's and need to layout views (show/hide) based on external data, but cannot use autolayout.

  • NSString+PDRegex

    Simplifying use of Regular Expressions

  • MKMapView+MoveLogo

    This category allows you to move the MKMapView logo so that it remains visible if you put other stuff on the mapview. If the logo is hidden, the app won't pass the App Store review. Tested with iOS 5 through 7.

  • NSDate+Escort

    A NSDate utility library that is compatible with NSDate-Extensions API

  • UILabel+DynamicSizeMe

    Adjust UILabel to change it's frame according to it's content

  • UIView+Toast

    Android-style toast notifications to iOS.

  • UIImage+NYXImagesKit

    A set of efficient categories for UIImage class. It allows filtering, resizing, masking, rotating, enhancing... and more

  • UIViewController+MJPopup

    A UIViewController Category to display a ViewController as a popup with different transition effects

  • UIImage+MGImageUtilities

    Proportional Fill & Tinting

  • MultipleObjects+DTFoundation

    DTFoundation is a collection of utility methods and category extensions that Cocoanetics is standardizing on. This should evolve into a toolset of well-documented and -tested code to accelerate future development.

  • UIImageView+WebCache

    Asynchronous image downloader with cache support

  • UIColor+Colours

    Adds 100 predefined colors, some color helper methods and can generate color schemes

  • UIImage+PDFColoredImage

    Converts a black PDF image into a UIImage of any size, in any color

  • NSData+AsyncCacher

    NSData category for async loading data from url and calling block. Requested data is cached with NSCache and can be requested multiple times simultaneously.

  • NSDate+Helper

    A category to extend Cocoa's NSDate class with some convenience functions.

  • MultipleObjects+ObjectiveSugar

    ObjectiveC additions for humans. Ruby style.

  • MKMapView+ZoomLevel

    Setting zoom level in a MapView

  • NSObject+MKBlockAdditions

    Block based Category additions for AlertView and ActionSheets

  • NSString+Extensions

    A utility box for NSStrings. Converts to: SHA1, NSNumber. Test for being empty. Contains substrings and replace substrings from NSDictionary.

  • UIView+Utils

    ViewUtils is a collection of category methods designed that extend UIView with all the handy little properties and functionality that you always wished were built-in to begin with.

  • NSDate+TimeAgo

    A "time ago", "time since", "relative date", or "fuzzy date" category for NSDate and iOS, Objective-C, Cocoa Touch, iPhone, iPad

  • NSString+FontAwesome

    Enables FontAwesome for iOS

  • NSArray+FirstObject

    Gets the first object in an array or returns nil for empty array.

  • CCNode+GestureRecognizers

    GestureRecognizers support for cocos2d, just include category and you are ready to use gesture recognizers. Works with both 2.x and 1.x cocos2d.

  • NSObject+AutoDescription

    Enables easy and descriptive logging for any class (derived from NSObject)

  • CGRect+Additions

    Some functions for dealing with CGRects

  • UIView+ModifyFrame

    Makes modifying the view frame NOT hellish

  • NSObject+Swizzle

    Monkey-Patching iOS with Objective-C Categories Part III: Swizzling

  • NSString+UsefulShit

    Objective-C category demonstration

  • 参考阅读:
    苹果官方文档: Customizing Existing Classes  
     
    这个类别使用了Aspect Fill内容模式,可以自动根据图像内容进行调整,当检测到人脸时,它会以脸部中心替代掉以图片的几何中心。
    测试环境:Xcode 5.0,iOS 6.0以上

     
    Objective-C-RegEx-Categories是NSRegularExpression的一个延展,它可以把Object-C中的很多正则表达式合并成一个,简化了代码。
    这个库没有任何依赖性,适用于iOS 4+和OS X 10.7+。

     
    AutoCoding是一个NSObject的类目,提供了对NSCoding 和NSCopying的自动支持。
    兼容ARC和non-ARC编译目标
    支持iOS 7.0/Mac OS 10.9 (Xcode 5.0, Apple LLVM compiler 5.0)
     
    创建invocations的简单方法
     
    SHPersian是一个针对使用波斯语和阿拉伯语的iOS开发者提供的工具,包含了一个在Persian iOS app中为文本添加自定义外观的必需的类。

     
    在UILabel内计算内容的大小。
     
    记录UIViewController层次:包括你在视图控制器的名字,还有你进入层次的展示。
     
    你是不是一直希望将"userInfo"显示到UIAlertView上呢?通过Association这个category可以将任意的对象赋值给其它任意对象(从iOS3.1和mac os 10.6到最新的系统版本。)

     
     
    app重启时,清除UIWebView cookies。
     
    检测硬件设备的版本。
     
    是一个NSObject category,对于内存泄露的跟踪非常有用
     
    是对NSNotificationCenter and KVO的一个扩展,它能够自动移除观察者。
     
    UIApplication+NetworkActivity跟踪你最近进行过的网络操作,并管理NetworkActivityIndicator。
     
    以递归的方式遍历(查找)subview
     
    使用图层蒙版为视图添加圆角
     
    Stack subviews是按照索引进行垂直排序的。主要用于——使用xib时,以及需要进行view布局时(显示/隐藏)——当基于外部数据。不过不能用于autolayout。.
     
    简化正则表达式的使用
     
    这个类目允许你移动MKMapView logo,即使你放其他东西在mapview上它仍能保持可见。如果隐藏了logo,那将不能通过 App Store审核。已经在iOS 5-iOS 7上进行了测试。
     
    NSDate-Escort是一个NSDate实用库,兼容NSDate-Extensions API
     
    调整UILabel来根据内容改变其框架
     
    适用于iOS上的Android风格toas通知。
     
    NYXImagesKit是一个重组了多个有用的UIImage categories的iOS项目,可对图像/图片进行多个处理,比如筛选、模糊、优化、蒙版、调整大小、旋转以及保存等等。同时还提供了一个UIImageView子类从URL异步加载图片,并在下载完毕时展示图片。
     
    MJPopupViewController是一个 UIViewController Category,用于使用不同的过渡效果来把ViewController作为弹出视图进行展示。
     
    MGImageUtilities展示两个UIImage category:UIImage+ProportionalFill和UIImage+Tint。你可以通过UIImage+ProportionalFill调整任意图片的尺寸,可以使用UIImage+Tint来为图片着色。
     
    DTFoundation集合了实用方法和category的扩展,逐渐演变成一个文档齐全的工具集,记录和测试代码以加快开发。
     
    SDWebImage提供一个UIImageView类别,以支持加载管理源自网络的远程图片。具有异步加载、缓存管理、同一个URL下载次数控制和优化等特征。简单易用。
     
    100组漂亮的预制的色彩和配色方案可以让你的iOS/OS X开发更轻松。

    UIImage-PDFColoredImage是一个UIImage扩展,可以把黑色的PDF image转换成任意尺寸任意颜色的UIImage,只需一行代码,简单易用。
     
    NSData-AsyncCacher是NSData的一个category,用于从url和block中异步加载数据。请求数据使用NSCache缓存,可以多次请求。
     
    通过一些便捷函数扩展了Cocoa的NSDate
     
    Objective-C additions for humans. Ruby style.
     
    在MapView中设置缩放比例。
     
    一个针对NSStrings的category,它能将string转换为SHA1,NSNumber。检测string是否为空、是否包含某个子字符串,以及替换掉NSDictionary中的子字符串。
     
    ViewUtils是一个category methods的集合,这些方法是UIView的扩展,包含了许多方便的属性和方法,其中许多都是我们希望苹果内置的。
     
    让NSDate报告时间,比如"A moment ago", "30 seconds ago", "5 minutes ago", "Yesterday", "Last month", "2 years ago"以及其他。
     
    FontAwesome+iOS是一个开源形象字体库,通过扩展 NSString 让你在app中轻松使用 FontAwesome 字体。

     
    从数组中获得第一个对象,或者从空数组中返回零
     
    能够简单地为任何类描述日志(从 NSObject派生出来)
     
    处理CGRects的一些函数。
     
    简单实用的UIView类目使修改框架不那么变态。
     
    Objective-C category 示范

  • 源地址:http://cocoacats.com/   http://www.cocoachina.com/applenews/devnews/2014/0212/7808.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值