判断设备及iOS版本的宏

来源:互联网 发布:sql注入攻击 epub 编辑:程序博客网 时间:2024/06/06 08:26

//判断设备是否是iPAD

static BOOL FBIsDeviceIPad() {

#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 30200

    if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) {

        return YES;

    }

#endif

    return NO;

}



 

//判断编译使用SDK版本号

#if __IPHONE_OS_VERSION_MAX_ALLOWED <= __IPHONE_2_2

        _closeButton.font = [UIFont boldSystemFontOfSize:12];

#else

        _closeButton.titleLabel.font = [UIFont boldSystemFontOfSize:12];

#endif




//判断设备的iOS版本号

if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 5.0)

{

    // iOS 5 code

}
else

{

    // iOS 4.x code
}

原创粉丝点击