我有一个设计复杂的项目,所以我喜欢根据iPhone设备的大小使用不同的故事板,苹果会批准吗?
强制使用自动布局有什么限制吗?
在不使用自动布局和大小类的情况下,如何使用最小故事板来完成此任务?
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
// Override point for customization after application launch.
// int screenHeight = [UIScreen mainScreen].bounds.size.height;
// NSLog(@"Screen Height is %i", screenHeight);
// grab correct storyboard depending on screen height
UIStoryboard *storyboard = [self grabStoryboard];
// display storyboard
self.window.rootViewController = [storyboard instantiateInitialViewController];
[self.window makeKeyAndVisible];
return YES;
}
- (UIStoryboard *)grabStoryboard {
// determine screen size
int screenHeight = [UIScreen mainScreen].bounds.size.height;
UIStoryboard *storyboard;
switch (screenHeight) {
// iPhone 4s
case 480:
storyboard = [UIStoryboard storyboardWithName:@"Main-4s" bundle:nil];
break;
// iPhone 5s
case 568:
storyboard = [UIStoryboard storyboardWithName:@"Main-5s" bundle:nil];
break;
// iPhone 6
case 667:
storyboard = [UIStoryboard storyboardWithName:@"Main-6" bundle:nil];
break;
// iPhone 6 Plus
case 736:
storyboard = [UIStoryboard storyboardWithName:@"Main-6-Plus" bundle:nil];
break;
default:
// it's an iPad
storyboard = [UIStoryboard storyboardWithName:@"Main" bundle:nil];
break;
}
return storyboard;
}发布于 2016-07-23 16:40:24
简短的回答
是
是的,苹果会批准这款应用。
然而,我建议使用一个故事板而不是多个故事板。
使用多个故事板的缺点是
最糟糕的事情是它有更多的机会错过一些故事板中的一些变化。
发布于 2016-07-23 16:56:36
是!Apple将接受您的应用程序。
为了帮助您分解设计,您可以使用情节提要引用来重用每个设备通用的情节提要部件。
http://code.tutsplus.com/tutorials/ios-9-staying-organized-with-storyboard-references--cms-24226
(仅适用于iOS 9)
发布于 2016-07-23 15:08:17
是的,苹果肯定会批准它,我已经在我的一个应用程序中使用了它。但这可能会增加内存消耗。
https://stackoverflow.com/questions/38539105
复制相似问题