判断ios版本

时间:2014-08-20 12:12:22   收藏:0   阅读:270

在AppDelegate方法里,添加类方法

+ (NSInteger)OSVersion;

实现为

+ (NSInteger)OSVersion
{
    static NSUInteger _deviceSystemMajorVersion = -1;
    static dispatch_once_t onceToken;
    dispatch_once(&onceToken, ^{
        _deviceSystemMajorVersion = [[[[[UIDevice currentDevice] systemVersion] componentsSeparatedByString:@"."] objectAtIndex:0] intValue];
    });
    return _deviceSystemMajorVersion;
}

使用时先导入

#import "AppDelegate.h"

直接使用[AppDelegate OSVersion]获取信息,如7,6等

判断ios版本,布布扣,bubuko.com

原文:http://www.cnblogs.com/xiaochaozi/p/3924129.html

评论(0
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!