Change View in iPad

In this application we will see how to change view in iPad.

Step 1: Create a Window base application using template. Give the application name “Windowbase_iPad”.

Step 2: Xcode automatically creates the directory structure and adds essential frameworks to it. You can explore the directory structure to check out the content of the directory.

Step 3: xpand classes and notice Interface Builder created the Windowbase_iPadAppDelegate class for you. Expand Resources and notice the template generated a separate nib, MainWindow.xib, for the “Windowbase_iPad”.

Step 4: We need to add two images in the resource folder. Give the name of the resources “1-1.png”,”2-1.png”.

Step 5: We have added QuartzCore.framework, select Frameworks -> add -> Existing frameworks -> selectQuartzCore.framework.

Step 6: In the Windowbase_iPadAppDelegate.h file, we have added instances of UIView and UIImageView class, and create one IBAction method. So make the following changes in the file.




Step 7: Double click your MainWindow.xib file open it to the Interface Builder. Open the the window and drag view from the library and place it to the window. Next drag Toolbar from the library and place it buttom of the view window. Now select WindowbaseiPadAppDelegate from the mainwindow (See figure 1), and bring up connection inspector. Select from subView to the view, and ChangeView to the BarButtonItem. Now save your .xib file and go back to the Xcode.

Figure 1: MainWindow.xib

Step 8: Open the Windowbase_iPadAppDelegate.m file and make the following changes in the file.



Step 9: Now compile and run the application in the Simulator.

You can Download SourceCode from here Windowbase_iPad

Leave a Comment:

Isaac says September 27, 2010

In Step 7 you say “Now select ViewChangeAppDelegate” when actually you mean “Now select Windowbase_iPadAppDelegate”.

Sushant says September 27, 2010

Isaac: Thanks for your comment! I have changed in the Step 7, and uploaded one snap shot. please check it. Still if your have problem then let us know.

Add Your Reply