How to Create Current Version-Based Xcode Windows Application

iPhones and iPads are on the course of unabated popularity, despite the heavy competition from close quarters, the demand for Apple devices continues to grow at a breathtaking rate. And due to this growing traction towards these devices, there are individuals taking up iOS programming to catch this wagon that holds great promises for their careers.

But all said and done, it is no hidden fact that iOS tools and technologies keep reinventing themselves and it’s only about time a newer version will be launched to make the current one obsolete. And that’s where many developers find it hard to catch up. Those who are used to working on the current versions of tools find it hard to adapt to the newer one. And Xcode falls in the same category as well.

The developers who have been working on a particular version of Xcode are not comfortable working with the newer version as it brings several new features and complications that are not comprehensible to the folks already expert at the current version.

Now, if you are a coder who wishes to create, let’s say, Xcode 4.0 style application using the Xcode 4.2, the process is very much possible. And this is how you do it:

Converting a new Empty Application into a Window-based Application

How to Create Current Version-Based Xcode Windows Application
Being an iPhone App Programmer, in order to begin with, you need to create an altogether new project, and you do so by creating the “Empty Application” project. As soon as you create this project, a new “Window-based Application” project will also be created cardinally, only with a bunch of dissimilarities:

  1. As the main controller class gets initiated, it gets initiated as “AppDelegate”. What you could have expected rather was it to be created as “<project-name>AppDelegate”.
  2. You won’t be able to find the XIB view.
  3. If you carefully observe with window property of AppDelegate, you will not notice any IBOutlet macro. As a result of this, it can’t be seen from the Interface Builder tooling.

Now, Let the Controller be Prepared  for Communicating with the Interface Builder Tooling

This is an indispensable step where tooling has to be made capacitated to identify the controller. And this is accomplished by adding the IBOutlet macro. To do so, you will need to play around with the controller header file. This is how you do it:

#import <UIKit/UIKit.h>
 @interface AppDelegate : UIResponder <UIApplicationDelegate>
 @property (strong, nonatomic) IBOutlet UIWindow *window;

As soon as you make the necessary modifications, save all the changes.

Next Stop: Updating the didFinishLaunchingWithOptions: method

The first line of the didFinishLaunchingWithOptions: method doesn’t allow seamless message communication. You need to comment the same:

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
    //self.window = [[[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]] autorelease];
    // Override point for customization after application launch.
    self.window.backgroundColor = [UIColor whiteColor];
    [self.window makeKeyAndVisible];
    return YES;


Now, Creating the XIB File Follows

Go to the folder that hosts the AppDelegate files and right-click on it. Now go for “Add File”. The new window you have will require you to select “Window”. Choose iPhone as the device family. Here, you get a default name for the file and it is Window.xib:How to Create Current Version-Based Xcode Windows Application 1

Changing the Class of the XIB file’s owner Follows

Now that you are in the Navigator, you need to select Window.xib. From there, you must go for “File’s Owner”. And then, the class has to be changed to UIApplication.How to Create Current Version-Based Xcode Windows Application 2

Controller Has to Be Equipped with an Object

Now, select the “Objects and Controllers” setting on the tool menu and following that, you will have to place the Object on the object pane through the drag and drop procedure.How to Create Current Version-Based Xcode Windows Application 3

Determine the Class

Now, the controller that was generated in lieu to your project, the class has to be set to that particular Controller.How to Create Current Version-Based Xcode Windows Application 4

XIB delegate has to be sent across to the controller

The MVC message routing has to be made more connective, or which, you need to select the “File’s Owner” cube in the object pane. Now, proceeding further, control+drag the delegate outlet to the App Delegate object.How to Create Current Version-Based Xcode Windows Application 5

Controller object’s window outlet has to be sent to to the window object

Now, again go for the ctrl+drag of the window outlet from the App Delegate object, and this time, to the Window object. And thus, following the above process, you can efficiently create a Xcode application on 4.2 version modelled on the 4.0 platform.

Infographic: Smart Bags for Smartphones, Tablets, Laptops
Apple Working on Revolutionary Wireless Charging Technology

Get more stuff like this
in your inbox

Subscribe to our mailing list and get interesting stuff and updates to your email inbox.