Three20 Core

TTGlobalCore

TTGlobalCore对Foundation Framework的扩展

创建不retain对象的集合 (通过对CFArray对象的retain, release赋以函数形式实现)
TTCreateNonRetainingArray()
TTCreateNonRetainingDictionary()

判断对象是否为集合
TTIsArrayWithItems(id object)
TTIsSetWithItems(id object)

判断字符串
TTIsStringWithAnyText(id object)

交换objc方法 (objc runtime)
TTSwapMethods(Class cls, SEL originalSel, SEL newSel)


TTGlobalCoreLocal
包含了与本地化相关的代码
TTCurrentLocal()
从standard user defaults中获取”AppleLanguages”(NSArray)中第一个的值,如果为空则调用[NSLocal currentLocal]

TTLocalizedString(NSString* key, NSString* comment)
从Three20.bundle中[bundle localizedStringForKey:key value:key table:nil]

TTDescriptionForError
如果error.domain为NSURLErrorDomain{本地化 NSURLErrorTimedOut, NSURLErrorNotConnectedToInternet 这两项错误,其它的显示为”Connection Error”的本地话字符串}

TTFormatInteger(NSInteger num)
以逗号分隔形式格式化整数


TTGlobalCorePaths
包函URL判断与设置默认Bundle及从默认bundle中取出资源的代码
TTIsBundleURL(NSString* URL) URL是否以”bundle://”开头
TTIsDocumentsURL(NSString* URL) URL是否以”document://”开头
TTSetDefaultBundle(NSBundle* bundle)
NSBundle* TTGetDefaultBundle()
NSString* TTPathForBundleResource(NSString* relativePath); 生成bundle的Resource目录中指定文件名的完整目录

NSString* TTPathForDocumentsResource(NSString* relativePath); 生成Documents目录中指定文件名的完整目录


TTGlobalCoreRects
包函与距形CGRect相关的函数
CGRect TTRectContract(CGRect rect, CGFloat dx, CGFloat dy)
CGRect TTRectShift(CGRect rect, CGFloat dx, CGFloat dy)
CGRect TTRectInset(CGRect rect, UIEdgeInsets insets)


NSArrayAdditions
两组遍历每个数组元素使其执行指定的方法
第一组 先复制自身再对复本执行方法,可能对数级元素进行修改
– (void)perform:(SEL)selector;
– (void)perform:(SEL)selector withObject:(id)p1;
– (void)perform:(SEL)selector withObject:(id)p1 withObject:(id)p2;
– (void)perform:(SEL)selector withObject:(id)p1 withObject:(id)p2 withObject:(id)p3;
第二组 不复制自身,禁止修改数据元素
– (void)makeObjectsPerformSelector:(SEL)selector withObject:(id)p1 withObject:(id)p2;
– (void)makeObjectsPerformSelector: (SEL)selector
withObject: (id)p1
withObject: (id)p2
withObject: (id)p3;
查找方法
– (id)objectWithValue:(id)value forKey:(id)key;
– (id)objectWithClass:(Class)cls;
– (BOOL)containsObject:(id)object withSelector:(SEL)selector;


NSDataAdditions
两个Hash方法
– (NSString*)md5Hash
– (NSString*)sha1Hash


NSMutableArray
添加非空字串
– (void)addNonEmptyString:(NSString*)string


NSMutableDictionary
– (void)setNonEmptyString:(NSString*)string forKey:(id)key
为key添加非空字串值,不判断key是否为非空


NSObjectAdditions
对performSelector的扩展,允许最多带7个参数
– (id)performSelector:(SEL)selector withObject:(id)p1 withObject:(id)p2 withObject:(id)p3;
– (id)performSelector:(SEL)selector withObject:(id)p1 withObject:(id)p2 withObject:(id)p3
withObject:(id)p4;
– (id)performSelector:(SEL)selector withObject:(id)p1 withObject:(id)p2 withObject:(id)p3
withObject:(id)p4 withObject:(id)p5;
– (id)performSelector:(SEL)selector withObject:(id)p1 withObject:(id)p2 withObject:(id)p3
withObject:(id)p4 withObject:(id)p5 withObject:(id)p6;
– (id)performSelector:(SEL)selector withObject:(id)p1 withObject:(id)p2 withObject:(id)p3
withObject:(id)p4 withObject:(id)p5 withObject:(id)p6 withObject:(id)p7;


NSStringAdditions
字串的判断
– (BOOL)isWhitespaceAndNewlines;
– (NSDictionary*)queryContentsUsingEncoding:(NSStringEncoding)encoding;
将URL查询字串转为字典,每个key对应一个数组,以应对有多个(相同的key)=value对,无value时value=[NSNull null]
– (NSString*)stringByAddingQueryDictionary:(NSDictionary*)query
在当前字串后添加query,过程中会对query的值做URL Encoding
– (NSString*)stringByRemovingHTMLTags;
– (NSComparisonResult)versionStringCompare:(NSString *)other;
* 示例 (?? 代表不确定):
* “3.0” = “3.0”
* “3.0a2” = “3.0a2”
* “3.0” > “2.5”
* “3.1” > “3.0”
* “3.0a1” < "3.0" * "3.0a1" < "3.0a4" * "3.0a2" < "3.0a19" <-- 不按字典顺序,按数字顺序, 只能用'a' * "3.0a" < "3.0a1" * "3.02" < "3.03" * "3.0.2" < "3.0.3" * "3.00" ?? "3.0" * "3.02" ?? "3.0.3" * "3.02" ?? "3.0.2" - (NSString*)md5Hash - (NSString*)sha1Hash

TTExtensionLoader
添加扩展方法:为TTExtentionLoader浅耕加Catelog
为方法名命为- (BOOL)loadExtensionNamed

+ (void)loadAllExtensions;
调用的唯一方法

+ (NSDictionary*)availableExtensions;

+ (NSDictionary*)loadedExtensions;
+ (NSDictionary*)failedExtensions;


TTEntityTables
XML entity Table ?


TTMarkupStripper
去标签

发表评论

电子邮件地址不会被公开。 必填项已用*标注