gpt4 book ai didi

iphone - iOS 6 背景图片

转载 作者:行者123 更新时间:2023-12-03 19:01:05 25 4
gpt4 key购买 nike

我有一个带有全屏渐变背景的 iOs 应用程序。现在,iPhone 5 的屏幕尺寸有所不同,当然我希望同时支持第 5 和第 4 设备。

推荐的方法是什么?

最佳答案

来 self 在评论中链接到的帖子

#import <sys/utsname.h>

NSString*
machineName()
{
struct utsname systemInfo;
uname(&systemInfo);

return [NSString stringWithCString:systemInfo.machine
encoding:NSUTF8StringEncoding];
}

结果应该是:

@"i386"      on the simulator
@"iPod1,1" on iPod Touch
@"iPod2,1" on iPod Touch Second Generation
@"iPod3,1" on iPod Touch Third Generation
@"iPod4,1" on iPod Touch Fourth Generation
@"iPhone1,1" on iPhone
@"iPhone1,2" on iPhone 3G
@"iPhone2,1" on iPhone 3GS
@"iPad1,1" on iPad
@"iPad2,1" on iPad 2
@"iPhone3,1" on iPhone 4
@"iPhone4,1" on iPhone 4S

我假设这将返回类似@“iPhone5,1”的最新型号。然后只需进行检查

NSString *iphoneType = machineName();
if ([iphoneType isEqualToString@"iPhone5,1"]){
//image for iphone 5
} else {
//image for the rest
}

如果可行请告诉我

关于iphone - iOS 6 背景图片,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12631672/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com