ios-for easy project development Add some common macro definitions to the PCH

Source: Internet
Author: User

1. About NSLog Output
/** *  When Xcode is release does not output, for debug output * *  @param ... * *  @return *  /#ifndef __optimize__#define NSLog (...) NSLog (__va_args__)/** *  You can see the class name, method, and number of rows when printing * *///#define NSLOG (FMT,...) NSLog (@ "%s [line%d]" FMT), __pretty_function__, __line__, # # __va_args__); #else # define NSLOG (...) {} #endif
2. Color
#define RGB_COLOR (r,g,b) [Uicolor colorwithred: (r)/255.0 Green: (g)/255.0 Blue: (b)/255.0 alpha:1.0] #define Rgb_ Coloralpha (r,g,b,a) [Uicolor colorwithred: (r)/255.0 Green: (g)/255.0 Blue: (b)/255.0 alpha:a] #define RGB (rgbvalue) [ Uicolor colorwithred: ((float) ((Rgbvalue & 0xFF0000) >>)/255.0 Green: ((float) ((Rgbvalue & 0xff00) > > 8)/255.0 Blue: ((float) (Rgbvalue & 0xFF)/255.0 alpha:1.0] #define RGBALPHA (rgbvalue,a) [Uicolor colorwithred: ((float) ((Rgbvalue & 0xFF0000) >>)/255.0 Green: ((float) ((Rgbvalue & 0xff00) >> 8)/255.0 Blue: (float) (Rgbvalue & 0xFF))/255.0 Alpha: (a)]
3. Screen size
#define App_size [UIScreen mainscreen].bounds.size#define app_width ([UIScreen mainscreen].bounds.size.width) #define App_height ([UIScreen mainscreen].bounds.size.height)
4. System version
#define Ppsystemversiongreaterorequalthan (version) ([[[Uidevice Currentdevice] systemversion] Floatvalue] >= Version
<pre name= "code" class= "OBJC" > #define Ios_version [[[Uidevice Currentdevice] systemversion] floatvalue]

(constantly updated)

Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

ios-for easy project development Add some common macro definitions to the PCH

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.