常用宏定义

 //兼容ARC

 

#ifndef __has_feature

#define __has_feature(x) 0

#endif

#ifndef __has_extension

#define __has_extension __has_feature // Compatibility with pre-3.0 compilers.

#endif

 

#if __has_feature(objc_arc) && __clang_major__ >= 3

#define PP_ARC_ENABLED 1

#endif // __has_feature(objc_arc)

 

#if PP_ARC_ENABLED //huang

#define PP_RETAIN(xx) (xx)

#define PP_RELEASE(xx)  xx = nil

#define PP_AUTORELEASE(xx)  (xx)

#else

#define PP_RETAIN(xx)           [xx retain]

#define PP_RELEASE(xx)          [xx release], xx = nil

#define PP_AUTORELEASE(xx)      [xx autorelease]

#endif

- (void) dealloc {

    PP_RELEASE(_rootViewController);

    PP_RELEASE(_viewControllers);

    PP_RELEASE(_viewControllersOffsets);

    [self removeAllGestures];

    PP_RELEASE(_gestures);

    

    [[NSNotificationCenter defaultCenter] removeObserver:self

                                                    name:UIApplicationWillChangeStatusBarFrameNotification

                                                  object:nil];

#if !PP_ARC_ENABLED

    [super dealloc];

#endif

}

 

#ifndef PPRSLog

#if DEBUG  

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

#else

#define PPRSLog(fmt, ...)

#endif

#endif

//DEBUG在PROJECT-》Build Setting->Apple LLVM Compiler ->DEBUG 里设定 DEBUG = 1;

#define PPSystemVersionGreaterOrEqualThan(version) ([[[UIDevice currentDevice] systemVersion] floatValue] >= version)

//    if (PPSystemVersionGreaterOrEqualThan(5.0))

//    {}

 

 

 

你可能感兴趣的:(宏)