我正在为iphone和ipod设计一个应用程序客户希望iphone和ipod的一些UI规范不同,所以我决定为iphone和ipod创建不同的XIB文件,就像在iphone和ipod的通用应用程序中一样,但问题是我无法在运行时区分iphone和ipod有没有办法在运行时检查平台以便在运行时加载不同的Nib文件如果有任何代码或教程,请提前引导我到链接谢谢
发布于 2011-10-25 20:40:28
我想这个问题已经被问过好几次了。)
NSString *dtype = [UIDevice currentDevice].model;
if([dtype isEqualToString:@"iPhone"])
{
// iphone
}模型字符串的可能示例是@“iPhone”和@“iPod touch”
发布于 2011-10-25 20:40:31
[UIDevice当前设备型号]看起来是此信息的正确来源。您可以检查它是否包含iPod触摸或iPhone或.....
发布于 2011-10-25 20:41:59
检查UIDevice类的模型属性
http://developer.apple.com/library/ios/#documentation/uikit/reference/UIDevice_Class/Reference/UIDevice.html
但是,如果您打开该字符串,请注意模拟器显示为一个单独的设备。
这一点:
NSString* model = [[UIDevice currentDevice] model];
NSLog(@"model: %@", model);输出:
2011-10-25 08:44:30.794 Craplet[921:b303] model: iPhone Simulatorhttps://stackoverflow.com/questions/7889352
复制相似问题