IOS Common Macro Definitions

Source: Internet
Author: User

Here are some of the macro definitions commonly used in IOS development:

//General tip information#define Malertview (title, msg) \Uialertview *alert = [[Uialertview alloc] Initwithtitle:title message:msgDelegate: Nil Cancelbuttontitle:@ "OK"Otherbuttontitles:nil]; [Alert show];#Define system_version_greater_than_or_equal_to (v) ([[[[Uidevice Currentdevice] systemversion] Compare: V Options:nsnumericsearch]! = nsorderedascending)//GCD#Define Back (block) Dispatch_async (dispatch_get_global_queue (dispatch_queue_priority_default, 0), Block)#Define MAIN (block) Dispatch_async (Dispatch_get_main_queue (), block)//----------interface design-------#define mnavbarheight#define mtabbarheight#define mscreenwidth ([UIScreen mainscreen].bounds.size.width)#define mscreenheight ([UIScreen mainscreen].bounds.size.height)//----------system---------#define Mretina ([UIScreen instancesrespondtoselector: @selector (currentmode)]? Cgsizeequaltosize (Cgsizemake (640, 960), [[UIScreen Mainscreen] currentmode].size): NO)#define mIsiP5 ([UIScreen instancesrespondtoselector: @selector (currentmode)]? Cgsizeequaltosize (Cgsizemake (640, 1136), [[UIScreen Mainscreen] currentmode].size): NO)#define mIsiP6 ([UIScreen instancesrespondtoselector: @selector (currentmode)]? Cgsizeequaltosize (Cgsizemake, 1334), [[UIScreen Mainscreen] currentmode].size): NO)#define misip6plus ([UIScreen instancesrespondtoselector: @selector (currentmode)]? Cgsizeequaltosize (Cgsizemake (1242, 2208), [[UIScreen Mainscreen] currentmode].size): NO)#define Mispad (ui_user_interface_idiom () = = Uiuserinterfaceidiompad)#define Misiphone (ui_user_interface_idiom () = = Uiuserinterfaceidiomphone)#define misios7orlater ([msystemversion floatvalue] >= 7.0? Yes:no)#define misios8orlater ([msystemversion floatvalue] >= 8.0? Yes:no)#define msystemversion ([[[Uidevice Currentdevice] systemversion])#define mdeviceopenudid ([openudid value])#define Mdevicemodel ([[[Uidevice Currentdevice] model])#define mdevicename ([[[Uidevice Currentdevice] name])#define mcurrentlanguage ([[[Nslocale Preferredlanguages] objectatindex:0])#define mappversion [[[[NSBundle Mainbundle] infodictionary] objectforkey:@ "cfbundleversion"]#Define mfirstlaunch mappversion//In the system version to determine whether the first event, including the promotion#define mfirstrun @ "FirstRun"//judge whether the first run, after the upgrade does not count

IOS Common Macro Definitions

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.