Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What are the macros used by iOS

2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/02 Report--

This article is about the content of macros used by iOS. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.

Some commonly used macro judgments, met me in the update, step by step to adhere to

Determine the version of the system

# define IOS_Syteam [UIDevice currentDevice] systemVersion] floatValue]

Color

# define RGBACOLOR [UIColor colorWithRed: (r) / 255.0f green: (G) / 255.0f blue: (B) / 255.0f alpha: (a)]

/ / get screen width and height

# define SCREEN_WIDTH ([UIScreen mainScreen] .bounds.size.width)

# define SCREEN_HEIGHT ([UIScreen mainScreen] .bounds.size.height)

/ / get the current language

# define CurrentLanguage ([[NSLocale preferredLanguages] objectAtIndex:0])

/ / rgb color conversion (hexadecimal-> decimal)

# define UIColorFromRGB (rgbValue) [UIColor colorWithRed: (float) ((rgbValue & 0xFF0000) > 16) / 255.0 green: ((float) ((rgbValue & 0xFF00) > > 8)) / 255.0 blue: ((float) (rgbValue & 0xFF)) / 255.0 alpha:1.0]

Rewrite the print log and current lines in NSLog,Debug mode

# if DEBUG

# define NSLog (FORMAT,...) Fprintf (stderr, "\ nfunction:%s line:%d content:%s\ n", _ _ FUNCTION__, _ _ LINE__, [NSString stringWithFormat:FORMAT, # # _ VA_ARGS__] UTF8String])

# else

# define NSLog (FORMAT,...) Nil

# endif

Thank you for reading! This is the end of this article on "what macros are used in iOS". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, you can share it for more people to see!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report