I want to modify a part of the AppDelegate.m so that it will open the iPhone3.5-inch or iPhone4-inch or the iPad view controller.
Here is the part I modified:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
// Override point for customization after application launch.
if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone) {
self.viewController = [[BumpGameUniversalViewController alloc] initWithNibName:@"BumpGameUniversalViewController_iPhone" bundle:nil];
} else {
self.viewController = [[BumpGameUniversalViewController alloc] initWithNibName:@"BumpGameUniversalViewController_iPad" bundle:nil];
}
self.window.rootViewController = self.viewController;
[self.window makeKeyAndVisible];
return YES;
}
This is the modification:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone) {
if([UIScreen mainScreen].bounds.size.height == 568.0){
//move to your iphone5 storyboard
self.viewController = [[BumpGameUniversalViewController_iPhone5 alloc] initWithNibName:@"BumpGameUniversalViewController_iPhone5" bundle:nil];
NSLog(@"in get iphone5 view");
}
else{
//move to your iphone4s storyboard
self.viewController = [[BumpGameUniversalViewController alloc] initWithNibName:@"BumpGameUniversalViewController_iPhone" bundle:nil];
}
} else {
self.viewController = [[BumpGameUniversalViewController alloc] initWithNibName:@"BumpGameUniversalViewController_iPad" bundle:nil];
}
self.window.rootViewController = self.viewController;
[self.window makeKeyAndVisible];
return YES;
}
The problem is that Xcode says the pointer types do not mach for [BumpGameUniversalViewController_iPhone5 alloc] and @"BumpGameUniversalViewController_iPhone5". How can I fix this or are there any other solutions for seperating the displays. I do not want to use autolayout because I want to support older iOS devices.
Thanks in advance.
0 comments:
Post a Comment