美文网首页
iOS 获取手机机型颜色 笔记

iOS 获取手机机型颜色 笔记

作者: 豪冷 | 来源:发表于2019-05-30 09:48 被阅读0次
    - (void)jh_deviceColor{
        UIDevice *device = [UIDevice currentDevice];
        SEL selector = NSSelectorFromString(@"deviceInfoForKey:");
        if (![device respondsToSelector:selector]) {
            selector = NSSelectorFromString(@"_deviceInfoForKey:");
            if ([device respondsToSelector:selector]) {
                IMP imp = [device methodForSelector:selector];
                NSString *(*func)(id ,SEL, NSString*) = (void *)imp;
                NSString *deviceColor = func(device,selector,@"DeviceColor");
                NSString *deviceEnclosureColor = func(device, selector, @"DeviceEnclosureColor");
                NSLog(@"deviceColor:%@,deviceEnclosureColor:%@", deviceColor,deviceEnclosureColor);
            }
        }
    }
    

    相关文章

      网友评论

          本文标题:iOS 获取手机机型颜色 笔记

          本文链接:https://www.haomeiwen.com/subject/vqfmtctx.html