可能重复:
How to develop or migrate apps for iPhone 5 screen resolution?独立故事板的iPhone 5和iPhone 4S
我怎样才能加载iPhone 5和iPhone 4S/4/3G单独故事板??
我瓦纳做到这一点,因为屏幕尺寸的iPhone 5
可能重复:
How to develop or migrate apps for iPhone 5 screen resolution?独立故事板的iPhone 5和iPhone 4S
我怎样才能加载iPhone 5和iPhone 4S/4/3G单独故事板??
我瓦纳做到这一点,因为屏幕尺寸的iPhone 5
在你的应用程序代理不同,您将需要在- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
CGRect screenBounds = [[UIScreen mainScreen] bounds];
if (screenBounds.size.height == 568) {
self.viewController = [[ViewController alloc] initWithNibName:@"ViewController_4inch" bundle:nil];
} else {
self.viewController = [[ViewController alloc] initWithNibName:@"ViewController" bundle:nil];
}
添加/替换下面的代码,ViewController_4inch
是名称
UPDATE(故事板-具体回答)笔尖文件的
要在启动加载不同的故事板,使用此代码:
CGSize iOSDeviceScreenSize = [[UIScreen mainScreen] bounds].size;
if (iOSDeviceScreenSize.height == 480)
{
// Instantiate a new storyboard object using the storyboard file named Storyboard_iPhone35
UIStoryboard *iPhone35Storyboard = [UIStoryboard storyboardWithName:@"Storyboard_iPhone35" bundle:nil];
// Instantiate the initial view controller object from the storyboard
UIViewController *initialViewController = [iPhone35Storyboard instantiateInitialViewController];
// Instantiate a UIWindow object and initialize it with the screen size of the iOS device
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
// Set the initial view controller to be the root view controller of the window object
self.window.rootViewController = initialViewController;
// Set the window object to be the key window and show it
[self.window makeKeyAndVisible];
}
if (iOSDeviceScreenSize.height == 568)
{ // iPhone 5 and iPod Touch 5th generation: 4 inch screen
// Instantiate a new storyboard object using the storyboard file named Storyboard_iPhone4
UIStoryboard *iPhone4Storyboard = [UIStoryboard storyboardWithName:@"Storyboard_iPhone4" bundle:nil];
UIViewController *initialViewController = [iPhone4Storyboard instantiateInitialViewController];
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
self.window.rootViewController = initialViewController;
[self.window makeKeyAndVisible];
}
一个小的搜索会发现很多信息。尝试http://stackoverflow.com/a/12397309/300292。 – rsswtmr
实际上,我已经看到了这些解决方案,信箱模式或使用基于屏幕尺寸的代码重新设计。但我想为1136和960高度屏幕设计单独的StoryBoard。我们可以使用pList为iPad和iPhone制作单独的故事板。但我想知道,是否有可能为iPhone 5和iPhone 4S加载不同的故事板.... – iSaalis
当下一个iPhone是1280x1024时会发生什么?或者出现类似尺寸的迷你iPad?我的观点是,你需要摆脱每种形式因素的设计习惯,并开始使用新的布局约束工具。想象一下,如果你必须重新设计一个PC应用程序的每一个可能的屏幕分辨率... – rsswtmr