I am doing a universal application which has 2 app delegates separately for iPhone and iPad. Can I check the device in a single app delegate using a bool value set to yes something like BOOL isiPhone and the method +(AppDelegate*)instance;. Then how can I launch different views? I got some code snippet like this
@interface AppDelegate : NSObject <UIApplicationDelegate, NSFetchedResultsControllerDelegate> {
UIWindow* window;
BOOL isiPhone;
@property (nonatomic, retain) IBOutlet UIWindow* window;
@property (nonatomic, assign) BOOL isiPhone;
+ (AppDelegate*)instance;
@end
And in the Application’s App Delegate m file:
@synthesize m_ForIPhone;
self.MapVC = [[MapViewController alloc] initWithNibName:(self.isiPhone ? @"MapView" : @"MapView@pad") bundle:nil];
self.DetailVC = [[DetailViewController alloc] initWithNibName:self.isiPhone ? @"DetailView" : @"DetailView@pad" bundle:nil];
self.AboutVC = [[AboutViewController alloc] initWithNibName:self.isiPhone ? @"AboutView" : @"AboutView@pad" bundle:nil];
Use the Following Code
whenever you are required to access to the delegate.