日韩av黄I国产麻豆传媒I国产91av视频在线观看I日韩一区二区三区在线看I美女国产在线I麻豆视频国产在线观看I成人黄色短片

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 >

iphone 常用预编译代码

發布時間:2025/7/14 35 豆豆
生活随笔 收集整理的這篇文章主要介紹了 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 常用预编译代码的全部內容,希望文章能夠幫你解決所遇到的問題。

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