iOS 小知识-tips
--->1<---
arc的项目中使用非arc代码,则添加-fno-objc-arc;
非arc项目中使用arc代码,则添加-fobjc-arc。
--->2<---
实用的类
NSKeyedArchiver
[UIScreen mainScreen]
[UIDevice currentDevice]
[UIFont familyNames]
[UIApplication sharedApplication]
[NSUserDefaults standardUserDefaults]
[NSNotificationCenter defaultCenter]
[NSBundle mainBundle]
[NSLocale preferredLanguages]
便利的宏
#define rgba(r,g,b,a) [UIColor colorWithRed:(r)/255.0 green:(g)/255.0 blue:(b)/255.0 alpha:(a)]
//程序沙盒 NSHomeDirectory()
#define LLC_SandBox_Document NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES)[0]
#define LLC_SandBox_Library NSSearchPathForDirectoriesInDomains(NSLibraryDirectory, NSUserDomainMask, YES)[0]
#define LLC_SandBox_Temp NSTemporaryDirectory()
/** DEBUG LOG **/
#ifdef DEBUG
#define DLog( s, ... ) NSLog( @"< %@(%d)(%s) >\n%@", [[NSString stringWithUTF8String:__FILE__] lastPathComponent],__LINE__,__PRETTY_FUNCTION__ , [NSString stringWithFormat:(s), ##__VA_ARGS__] )
#else
#define DLog( s, ... )
#endif
#define BACK(block) dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), block)
#define MAIN(block) dispatch_async(dispatch_get_main_queue(),block)
#define IMGBGLS(tpImg) (tpImg) = [(tpImg) stretchableImageWithLeftCapWidth:floorf((tpImg).size.width/2) topCapHeight:floorf((tpImg).size.height/2)] //从1/2的宽,1/2的高方向,拉伸图片
#define FilterHtmlText(x) (x)=[[(x) componentsSeparatedByCharactersInSet: [NSCharacterSet characterSetWithCharactersInString:@"[]{}(<p><br/></p>#%-*+=_)\\|~(<>$%^&*)_+ "]]componentsJoinedByString: @""]
--->3<---