Reputation: 1845
I am working on xcode project intended to make a universal app.With the window based application template i got 3 AppDelegate Methods.2 for both ipad and iphone each and 1 Main AppDelegate method.When i run it for ipad ,the Main AppDelegate method is being called but when i run it for iphone environment ,the Main AppDelegate is not getting called.So how to get the controller to Main Appdelegate method while running it for Iphone environment..??
Here is description.. I have 3 appdelegate methods ,viz.prjOUMAppDelegate(main appdelegate),prjOUMAppDelegate_iPhone(for iphone),prjOUMAppDelegate_iPad(for ipad).. I have some common methods like creating folders and moving files written in prjOUMAppDelegate(main appdelegate)method.I want it to run everytime irrespective of device ,so that i can get my folders created and some files to be moved.Its working fine when i run it for ipad(i.e creating folders and moving files ) but when i change the environment to iphone ,the prjOUMAppDelegate(main appdelegate) method is not getting called..so i dont know where iam getting wrong..
Upvotes: 0
Views: 726
Reputation: 2256
Ok, Your question is really a confusing one. I think you are looking for something like this
- (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 = //Initialize the ViewController for iPhone environment
}
else {
self.viewController = //Initialize the ViewController for iPad environment
}
self.navigationController = [[UINavigationController alloc]
initWithRootViewController:self.viewController];
[self.window addSubview:self.navigationController.view];
[self.window makeKeyAndVisible];
return YES;
}
If this is not the answer you are looking for then please update your question with some code.
Upvotes: 2