I have my ipad code created programmatically not using nib.I converted my ipad app to universal app as follows:
Choose the project target(the blue one on the sidebar). Summary -> iOS Application Target -> set Devices to Universal.
Now I want to launch different app delegate for iphone and different app delegate for ipad.There is already one app delegate for ipad, now I want to create different app delegate for iphone so that in main.m I can launch different app delegate based on device(ipad & iphone).So my question is, can I create different app delegate, if yes then how?
You don't even need to worry about the "appDelegateName" variable there. Just call return as shown here:
You should be able to do this through the XIB for your App. By default, the AppDelegate is assigned by the connection between the
MainWindow.xib
(or whatever your main XIB file is called)'s File Owner and the delegate outlet. If you used the converter, then theMainWindow~ipad.xib
should have a similar outlet, which also currently points to the same delegate. If you want them to be different, create a new AppDelegate subclass and assign it to the outlet in the~ipad
version of the XIB and it should be the equivalent of calling UIApplicationMain without having to do that manually.in the projects
main.m
you could do something like
But IMO you should not do it.
Instead doi it as apple does it to, in app delegate load different view controllers or different XIBs.