I have a main .xib file that contains an App Delegate, Window, and View Controller ABC objects. When I click on the object “View Controller ABC”, it shows it’s outlets defined in the .h class file.
Now I want the main .xib to show a different View Controller XYZ on first init. How do I replace the view controllers? I tried dragging a new View Controller object, but I don’t know how it references the XYZ class.
App Delegate .h
@interface JabberClientAppDelegate : NSObject <UIApplicationDelegate> {
UIWindow *window;
ViewControllerXYZ *viewController;
}
@property (nonatomic, retain) IBOutlet UIWindow *window;
@property (nonatomic, retain) IBOutlet ViewControllerXYZ *viewController;
App Delegate .m
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
[DDLog addLogger:[DDTTYLogger sharedInstance]];
self.window.rootViewController = self.viewController;
[self.window makeKeyAndVisible];
return YES;
}
I tried to replace the View Controller property with the new XYZ class. But the .xib doesn’t get updated.
Any suggestions how to update the .xib?
Thanks
I guess you need to change the kind of class for your
UIViewControlleron the XIB, so you can access theIBOutletsof your XYZUIViewController. Like this: