iOS Modify App Delegate
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 = [[UIWindowalloc] initWithFrame:[[UIScreenmainScreen] bounds]];
// Override point for customization after application launch.
if ([[UIDevicecurrentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone) {
self.viewController = [[BumpGameUniversalViewControlleralloc] initWithNibName:@"BumpGameUniversalViewController_iPhone"bundle:nil];
} else {
self.viewController = [[BumpGameUniversalViewControlleralloc] initWithNibName:@"BumpGameUniversalViewController_iPad"bundle:nil];
}
self.window.rootViewController = self.viewController;
[self.windowmakeKeyAndVisible];
returnYES;
}
This is the modification:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
self.window = [[UIWindowalloc] initWithFrame:[[UIScreenmainScreen] bounds]];
if ([[UIDevicecurrentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone) {
if([UIScreenmainScreen].bounds.size.height == 568.0){
//move to your iphone5 storyboard
self.viewController = [[BumpGameUniversalViewController_iPhone5alloc] initWithNibName:@"BumpGameUniversalViewController_iPhone5"bundle:nil];
NSLog(@"in get iphone5 view");
}
else{
//move to your iphone4s storyboard
self.viewController = [[BumpGameUniversalViewControlleralloc] initWithNibName:@"BumpGameUniversalViewController_iPhone"bundle:nil];
}
} else {
self.viewController = [[BumpGameUniversalViewControlleralloc] initWithNibName:@"BumpGameUniversalViewController_iPad"bundle:nil];
}
self.window.rootViewController = self.viewController;
[self.windowmakeKeyAndVisible];
returnYES;
}
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.
OS X Mountain Lion (10.8.2)