iPad 2确定设备颜色

时间:2011-03-30 00:49:41

标签: ios ipad cocoa-touch uikit

我试过在文档中查看并且没有成功。我想知道是否有办法确定iPad 2的颜色。我正在处理的应用程序,我想根据iPad的颜色改变设计的外观。

如果有可能,有什么想法吗?

3 个答案:

答案 0 :(得分:5)

有一种方法可以从序列号中检测iPhone的颜色。也许这可以用来检测iPad 2的颜色?

以下摘自http://itune2iphone.blogspot.com/2011/01/iphone-serial-number-secret-decode.html

Typically, the serial number of iPhone is in the following format:

AABCCDDDEEF
For example, 88025xxxA4T, where the serial information can be decoded as following:
AA = Factory and Machine ID
B = Year of Manufacturing (9 is 2009/2019, 0 is 2010/2020, 1 is 2011 and so on)
CC = Production Week (01 is week 1 of B, 11 is week 11 of B and so on)
DDD = Unique Identifier
EE = Color (A4=black)
F = size (S=16GB, T=32GB)

the last 3 digits of iPhone serial number are indicative of color and size and should be read together

VR0 (iPhone 2G Silver 4GB)
WH8 (iPhone 2G Silver 8GB)
0KH (iPhone 2G Silver 16GB)
Y7H (iPhone 3G Black 8GB)
Y7K (iPhone 3G Black 16GB)
3NP (iPhone 3GS Black 16GB)
3NR (iPhone 3GS Black 32GB)
3NQ (iPhone 3Gs White 16GB)
3NS (iPhone 3Gs White 32GB)
A4S (iPhone 4 Black 16GB)
A4T (iPhone 4 Black 32GB)

我知道这不是一个完整的答案,但也许您可以比较白色iPad2与相同尺寸和规格的黑色iPad2的序列号(例如,64G和看看代码有多么不同)。

我将首先列出我的iPad2序列号的最后三位数字:

FJ3 - iPad2 64GB黑色3G

答案 1 :(得分:2)

有一个私有API可以检索DeviceColorDeviceEnclosureColor

UIDevice *device = [UIDevice currentDevice];
SEL selector = NSSelectorFromString([device.systemVersion hasPrefix:@"7"] ? @"_deviceInfoForKey:" :  @"deviceInfoForKey:");
NSLog(@"DeviceColor: %@ DeviceEnclosureColor: %@", [device performSelector:selector withObject:@"DeviceColor"], [device performSelector:selector withObject:@"DeviceEnclosureColor"]);

我发表了关于此的博客,并编写了一个示例应用来说明这一点:

http://www.futuretap.com/blog/device-colors/

答案 2 :(得分:1)

也许不是最好的方式,但是我选择的方式,如果这是超级重要的(我会问你自己,如果你认为的话),那就是创建一个UIAlertView来提示用户从有限的列表中选择iPad的颜色。

享受!