Your favorite macros (encountered add)

Source: Internet
Author: User

1. Screen width screen height

#define Screen_width [UIScreen mainscreen].bounds.size.width

#define Screenh_height [UIScreen mainscreen].bounds.size.height

2. Get random Colors

#define Rrrandomcolor [Uicolor colorwithred:arc4random_uniform (/255.0 green:arc4random_uniform)/255.0 Blue: Arc4random_uniform (/255.0 alpha:1.0]

3. Color

#define Rrcolor (R, G, b) [Uicolor colorwithred: (r)/255.0 Green: (g)/255.0 Blue: (b)/255.0 alpha:1.0]

#define Rralphacolor (R, G, B, a) [Uicolor colorwithred: (r)/255.0 Green: (r)/255.0 Blue: (R)/255.0 Alpha:a]

#define Rrclearcolor [Uicolor Clearcolor]

4.Log

Rrlog (...) NSLog (@ "%s line%d \%@\n\n", __func__,__line__,[nsstring stringwithformat:__va_args__])

5. Empty sentences

is empty or [NSNull null]

#define NOTNILANDNULL (_ref) (((_ref)! = nil) && (![ (_REF) isequal:[nsnull Null]]))

#define ISNILORNULL (_ref) (((_ref) = nil) | | ([(_REF) isequal:[nsnull Null]]))

Whether the string is empty

#define ISSTREMPTY (_ref) (((_ref) = nil) | | ([(_REF) isequal:[nsnull null]]) | | ([(_ref) isequaltostring:@ ""]) | | ([(_ref) isequaltostring:@ "(null)"]))

Whether the array is empty

#define ISARREMPTY (_ref) (((_ref) = nil) | | ([(_REF) isequal:[nsnull null]]) | | ([(_REF) count] = = 0))

#define ISNUMBEREMPTY (_ref) ((_ref) = nil) | | ((_ref). Floatvalue = = 0)

Your favorite macros (encountered add)

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.