码迷,mamicode.com
首页 > 移动开发 > 详细

iOS 小知识-tips

时间:2014-04-28 15:19:16      阅读:579      评论:0      收藏:0      [点我收藏+]

标签:com   class   img   size   ext   string   width   color   log   get   ble   

--->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<---

 

iOS 小知识-tips,布布扣,bubuko.com

iOS 小知识-tips

标签:com   class   img   size   ext   string   width   color   log   get   ble   

原文地址:http://www.cnblogs.com/loganv/p/3695354.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!