zoukankan      html  css  js  c++  java
  • 选择性编译代码:如 #ifdef __IPHONE_7_0

    选择性编译代码;


    选择性编译代码和选择性运行代码是不一样的,区别在于:
    1.选择性编译代码是在硬件或者系统不支持的情况下不会对该段代码进行编译,也就不会由于不兼容的问题导致报错
    #import <Availability.h> //定义来系统版本类别

    #ifdef __IPHONE_7_0

            [navBar setBackgroundImage:[UIImage imageNamed:@"NavBar64"] forBarMetrics:UIBarMetricsDefault];

    #endif

    2.选择性运行代码:是类似if等条件判断来执行的,但是前提时编译要成功,只是不一定会执行
     
     
    注释:在Availability.h中定义了很多版本类

    #define __MAC_10_0            1000

    #define __MAC_10_1            1010

    #define __MAC_10_2            1020

    #define __MAC_10_3            1030

    #define __MAC_10_4            1040

    #define __MAC_10_5            1050

    #define __MAC_10_6            1060

    #define __MAC_10_7            1070

    #define __MAC_10_8            1080

    #define __MAC_10_9            1090

    #define __MAC_10_10         101000

    /* __MAC_NA is not defined to a value but is uses as a token by macros to indicate that the API is unavailable */

    #define __IPHONE_2_0     20000

    #define __IPHONE_2_1     20100

    #define __IPHONE_2_2     20200

    #define __IPHONE_3_0     30000

    #define __IPHONE_3_1     30100

    #define __IPHONE_3_2     30200

    #define __IPHONE_4_0     40000

    #define __IPHONE_4_1     40100

    #define __IPHONE_4_2     40200

    #define __IPHONE_4_3     40300

    #define __IPHONE_5_0     50000

    #define __IPHONE_5_1     50100

    #define __IPHONE_6_0     60000

    #define __IPHONE_6_1     60100

    #define __IPHONE_7_0     70000

    #define __IPHONE_7_1     70100

    #define __IPHONE_8_0     80000

    #define __IPHONE_8_1     80100

  • 相关阅读:
    谷歌(google)广告尺寸大小列表
    D盘Program Files 文件夹里文件不显示,没隐藏。怎么才能显示出来?
    请问IOS中做一个手机网站的app壳复杂吗?
    zblog2.X 连不上数据库原因
    二叉查找树的实现与讲解(C++)
    记一次应用异常,处理过程
    C# RSA加密
    js对象 c#对象转换
    C# 微信消息模板 发送
    iis 虚拟目录 文件服务器
  • 原文地址:https://www.cnblogs.com/niexiaobo/p/4446592.html
Copyright © 2011-2022 走看看