#ifndef Macros_h#defineMacros_h#defineStatus_bar_height 20//NavBar Height#defineNavigation_bar_height 44//status bar + navigation bar height#defineStatus_and_navigation_height ((status_bar_height) + (navigation_bar_height))//Screen rect#defineScreen_rect ([UIScreen mainscreen].bounds)#defineScreen_width ([UIScreen mainscreen].bounds.size.width)#defineScreen_height ([UIScreen mainscreen].bounds.size.height)#defineContent_height (Screen_height-navigation_bar_height-status_bar_height)//Screen Resolution#defineScreen_resolution (Screen_width * screen_height * ([UIScreen Mainscreen].scale))//Advertisement Height#defineBanner_height 215#defineStylepage_height 21#defineSmalltv_height 77#defineSmalltv_width 110#defineFollow_height 220#defineSubchannel_height 62//file directory#defineKpathtemp Nstemporarydirectory ()#definekpathdocument [Nssearchpathfordirectoriesindomains (NSDocumentDirectory, Nsuserdomainmask, YES) objectAtIndex 700#defineKpathcache [Nssearchpathfordirectoriesindomains (Nscachesdirectory, Nsuserdomainmask, YES) objectAtIndex:0 ]#defineKpathsearch [kpathdocument stringbyappendingpathcomponent:@ "Search.plist"]#defineKpathmagazine [kpathdocument stringbyappendingpathcomponent:@ "Magazine"]#defineKpathdownloadedmgzs [Kpathmagazine stringbyappendingpathcomponent:@ "Downloadedmgz.plist"]#defineKpathdownloadurls [Kpathmagazine stringbyappendingpathcomponent:@ "Downloadurls.plist"]#definekpathoperation [Kpathmagazine stringbyappendingpathcomponent:@ "Operation.plist"]#defineKpathsplashscreen [Kpathcache stringbyappendingpathcomponent:@ "SplashScreen"]#endif//Log utils Marco#defineALog (FMT, ...) NSLog (@ "%s [line%d]" FMT), __pretty_function__, __line__, # #__VA_ARGS__);#ifdefDEBUG#defineDLog (FMT, ...) NSLog (@ "%s [line%d]" FMT), __pretty_function__, __line__, # #__VA_ARGS__);#else#defineDLog (...)#endif#ifdefDEBUG#defineUlog (...)//#define ULOG (FMT, ...) {Uialertview *alert = [[Uialertview alloc] initwithtitle:[nsstring stringwithformat:@ "%s\n [line%d]", __pretty_functio n__, __line__] message:[nsstring stringwithformat:fmt, # #__VA_ARGS__] delegate:nil cancelbuttontitle:@ "OK" Otherbuttontitles:nil]; [Alert show]; }#else#defineUlog (...)#endif//System version Utils#defineSystem_version_equal_to (v) ([[[Uidevice Currentdevice] systemversion] compare:v Options:nsnumericsearch] = = Nsorderedsame)#defineSystem_version_greater_than (v) ([[[Uidevice Currentdevice] systemversion] compare:v Options:nsnumericsearch] = = nsordereddescending)#defineSystem_version_greater_than_or_equal_to (v) ([[[Uidevice Currentdevice] systemversion] compare:v options: Nsnumericsearch]! = nsorderedascending)#defineSystem_version_less_than (v) ([[[Uidevice Currentdevice] systemversion] compare:v Options:nsnumericsearch] = = nsorderedascending)#defineSystem_version_less_than_or_equal_to (v) ([[[Uidevice Currentdevice] systemversion] compare:v options: Nsnumericsearch]! = nsordereddescending)//Get RGB color#defineRGBA (r,g,b,a) [Uicolor colorwithred:r/255.0f green:g/255.0f blue:b/255.0f alpha:a]#defineRGB (r,g,b) RGBA (r,g,b,1.0f)#defineIsportrait ([uiapplication sharedapplication].statusbarorientation = = Uiinterfaceorientationportrait | | [UIApplication sharedapplication].statusbarorientation = = Uiinterfaceorientationportraitupsidedown)#defineIsnilornull (_ref) (((_ref) = nil) | | ([(_REF) isequal:[nsnull Null]]))//Angle to radians#defineDegrees_to_radians (d) (d * m_pi/180)//iOS version greater than or equal to 7.0#defineIos7_or_later system_version_greater_than_or_equal_to (@ "7.0")//iOS version greater than or equal to 8.0#defineIos8_or_later system_version_greater_than_or_equal_to (@ "8.0")//IOS6, the starting height of the view in the navigation VC#defineYh_height (ios7_or_later? 64:0)//get the system time stamp#defineGetcurenttime [NSString stringwithformat:@ "%ld", (long) [[NSDate Date] timeIntervalSince1970]]//system Notification Definition#defineTncancelfavoriteproductnotification @ "Tncancelfavoriteproductnotification"//when you cancel a collection#defineTnmarkfavoriteproductnotification @ "Tnmarkfavoriteproductnotification"//when you mark a collection#defineknotficationdownloadprogresschanged @ "Knotficationdownloadprogresschanged"//Download Progress Changes#defineKnotificationpausedownload @ "Knotificationpausedownload"//Pause Download#defineKnotificationstartdownload @ "Knotificationstartdownload"//Start Download#defineknotificationdownloadsuccess @ "Knotificationdownloadsuccess"//Download Successful#defineknotificationdownloadfailed @ "knotificationdownloadfailed"//Download Failed#defineKnotificationdownloadnewmagazine @ "Knotificationdownloadnewmagazine"////////////////////////////////////////////////////////////////////////////////////////////////////Interface Name Correlation#ifdefDEBUG//Test API in debug State#defineapi_base_url_string @ "http://boys.test.companydomain.com/api/"#else//on-line API in release status#defineapi_base_url_string @ "http://www.companydomain.com/api/"#endif//Interface#defineGet_content_detail @ "Channel/getcontentdetail"//get content details (including previous and next)#defineGet_comment_list @ "Comment/getcommentlist"//get a list of comments#defineComment_login @ "Comment/login"//get a list of comments#defineComment_publish @ "Comment/publish"//Post a comment#defineComment_delete @ "Comment/delcomment"//Delete Comments#defineLoginout @ "Common/logout"//Log Out//Judging whether it's a real machine or a simulator#ifTarget_os_iphone//IPhone Device#endif#ifTarget_iphone_simulator//IPhone Simulator#endif
We know that in the development of the need to define a lot of properties, to facilitate our development, we wrote a more commonly used macro definition
IOS Development---macro definition Daquan