日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

iphone 常用预编译代码

發布時間:2025/7/14 编程问答 24 豆豆
生活随笔 收集整理的這篇文章主要介紹了 iphone 常用预编译代码 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

http://blog.sina.com.cn/u/2079395307??iphone和andorid開發博客

1.自定義DLog輸出

#ifdef DEBUGLOG

# ? define DLog(fmt, ...) NSLog((@"%s [Line %d] " fmt), __PRETTY_FUNCTION__, __LINE__, ##__VA_ARGS__);

#else

# ? define DLog(...)

#endif


2.判斷設備ios版本

#define SYSTEM_VERSION_GREATER_THAN(v)? ? ? ? ? ? ? ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] == NSOrderedDescending)

#define SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(v)? ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] != NSOrderedAscending)

#define SYSTEM_VERSION_LESS_THAN(v) ? ? ? ? ? ? ? ? ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] == NSOrderedAscending)

#define SYSTEM_VERSION_LESS_THAN_OR_EQUAL_TO(v) ? ? ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] != NSOrderedDescending)


3.判斷設備是否支持retina

#ifndef ImageShowcase_Utility_h

#define ImageShowcase_Utility_h

#define isRetina ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(640,960), [[UIScreen mainScreen] currentMode].size) : NO)

#endif


4.適配iphone5的屏幕

//adaptive iphone5 macro

#define iPhone5 ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(640,1136), [[UIScreen mainScreen] currentMode].size) : NO)

#define iPhoneAppFrame [[UIScreen mainScreen] applicationFrame]

#define iPhoneScreenBounds [[UIScreen mainScreen] bounds]


5.Debug 標記

??/*!

?? For debugging:

?? Go into the "Get Info" contextual menu of your (test) executable (inside the "Executables" group in the left panel of XCode).?

?? Then go in the "Arguments" tab. You can add the following environment variables:

? ?

?? Default: ? Set to:

?? NSDebugEnabled? ? ? ? ? ? ? ? ? ? ? ? NO ? ? ? "YES"

?? NSZombieEnabled ? ? ? ? ? ? ? ? ? ? ? NO ? ? ? "YES"

?? NSDeallocateZombies ? ? ? ? ? ? ? ? ? NO ? ? ? "YES"

?? NSHangOnUncaughtException ? ? ? ? ? ? NO ? ? ? "YES"

? ?

?? NSEnableAutoreleasePool? ? ? ? ? ? ? YES ? ? ? "NO"

?? NSAutoreleaseFreedObjectCheckEnabled? NO ? ? ? "YES"

?? NSAutoreleaseHighWaterMark ? ? ? ? ? ? 0 ? ? ? non-negative integer

?? NSAutoreleaseHighWaterResolution ? ? ? 0 ? ? ? non-negative integer

? ?

?? For info on these varaiables see NSDebug.h; http://theshadow.uw.hu/iPhoneSDKdoc/Foundation.framework/NSDebug.h.html

? ?

?? For malloc debugging see: http://developer.apple.com/mac/library/documentation/Performance/Conceptual/ManagingMemory/Articles/MallocDebug.html

?? */

6. ARC宏定義

#ifndef MB_STRONG

#if __has_feature(objc_arc)

? ? #define MB_STRONG strong

#else

? ? #define MB_STRONG retain

#endif

#endif


#ifndef MB_WEAK

#if __has_feature(objc_arc_weak)

? ? #define MB_WEAK weak

#elif __has_feature(objc_arc)

? ? #define MB_WEAK unsafe_unretained

#else

? ? #define MB_WEAK assign

#endif

#endif


7.ARC (Automatic Reference Counting)

JMImageCache?uses?Automatic Reference Counting (ARC). If your project doesn't use ARC, you will need to set the?-fobjc-arccompiler flag on all of the?JMImageCache?source files. To do this in Xcode, go to your active target and select the "Build Phases" tab. In the "Compiler Flags" column, set?-fobjc-arc?for each of the?JMImageCache?source files.




ARC (Automatic Reference Counting)

JMImageCache?uses?Automatic Reference Counting (ARC). If your project doesn't use ARC, you will need to set the?-fobjc-arccompiler flag on all of the?JMImageCache?source files. To do this in Xcode, go to your active target and select the "Build Phases" tab. In the "Compiler Flags" column, set?-fobjc-arc?for each of the?JMImageCache?source files.

ARC (Automatic Reference Counting)

JMImageCache?uses?Automatic Reference Counting (ARC). If your project doesn't use ARC, you will need to set the?-fobjc-arccompiler flag on all of the?JMImageCache?source files. To do this in Xcode, go to your active target and select the "Build Phases" tab. In the "Compiler Flags" column, set?-fobjc-arc?for each of the?JMImageCache?source files.

版權聲明:本文為博主原創文章,未經博主允許不得轉載。

轉載于:https://www.cnblogs.com/zsw-1993/archive/2012/11/02/4880683.html

總結

以上是生活随笔為你收集整理的iphone 常用预编译代码的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。