Macro definitions commonly used in IOS development--Welcome to Supplement

Source: Internet
Author: User

////CommonMacroDefinition.h//Learnthread////Created by Marico Sun in Beijing on 16/7/4.//copyright©2016 year QL. All rights reserved.////determine if log can print file name number of rows#ifdefNeed_debug#defineNSLog (format, ...)//Log Definition ...#else#defineNSLog (format, ...) Do{NSLog (@"<%@:%d:%s>-:%@", [[NSString stringwithutf8string:__file__] lastpathcomponent], __line__, __function__, [NSString Stringwithformat:format, # #__VA_ARGS__]); }  while(0)#endif///print in debug mode and release mode#ifdefDEBUG#defineLOG (...) NSLog (__va_args__)#else#defineLOG (...)#endif///Circular reference warnings caused by blcok and self?? The handling Problem#defineWeek_ref (obj) __weak typeof (obj) __# #obj = obj///access to local data#defineUserdefaults (Nsuserdefaults *) [Nsuserdefaults Standarduserdefaults]///Save constant information to local#defineUserdefaults_v_k (v,k) [Userdefaults setobject:v forkey:k]///gets the local saved constant information from V (V is key)#defineUserdefaults_k (K) [Userdefaults objectforkey:k]///Get version number#defineOSVERSION [[[Uidevice Currentdevice] systemversion] floatvalue]///get the properties of a view#defineGetviewwidth (view) view.frame.size.width#defineGetviewheight (view) view.frame.size.height#defineGetviewx (view) view.frame.origin.x#defineGetviewy (view) VIEW.FRAME.ORIGIN.Y///Screen Constants#definegetscreenwidth [[UIScreen Mainscreen] Bounds].size.width#definegetscreenheight [[UIScreen Mainscreen] Bounds].size.height///Get Picture Resources#defineGetImage (imageName) [UIImage imagenamed:[nsstring stringwithformat:@ "%@", ImageName]]///RGB color Settings#defineUicolorfromrgb (rgbvalue) [Uicolor colorwithred: ((float) ((Rgbvalue & 0xFF0000) >>))/255.0 Green: ((float) ( (Rgbvalue & 0xff00) >> 8)/255.0 Blue: ((float) (Rgbvalue & 0xFF))/255.0 alpha:1.0]///UUID#defineUUID [[[Uidevice Currentdevice] Identifierforvendor] uuidstring]///get the current language#defineCurrentlanguage ([[Nslocale preferredlanguages] objectatindex:0])

Welcome to Supplement

Macro definitions commonly used in IOS development--Welcome to Supplement

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.