【发布时间】:2016-05-17 16:21:22
【问题描述】:
我正在尝试以编程方式为iPhone 和iPad 创建splash screen。下面我添加了我正在使用的代码并将屏幕输出到 iPad2 模拟器显示半屏。我需要为 iPad 所有设备制作全屏尺寸。
下面是我的代码:
// The device is an iPad and iPad mini running iOS 3.2 or later.
CGSize result = [[UIScreen mainScreen] bounds].size;
if(result.height == 1024) {
// iPad, iPad 2, iPad Mini
splashImage.frame = CGRectMake(0, 0, 768,result.height);
[splashImage setImage:[UIImage imageNamed: @"Default-Portrait.png" ]];
activityIndicator.frame=CGRectMake(145, 240, 30, 30);
}
if(result.height == 2048) {
// iPad Air, iPad Mini Retina
splashImage.frame = CGRectMake(0, 0, 1536,result.height);
[splashImage setImage:[UIImage imageNamed: @"Default-Portrait.png" ]];
activityIndicator.frame=CGRectMake(145, 240, 30, 30);
}
【问题讨论】:
-
这正是它应该运行的方式,除非它是一个通用应用程序。如果是仅限 iPhone 的应用程序,它将像这样运行(就像 iPad 中的 iPhone 4s 和 4)。
标签: ios objective-c iphone ipad splash-screen