6. Create an Additional View for your Application

In this section we will cover adding an additional view to your already existing application.

Create a New View

To start click on our the project and go to file, new, choose Cocoa-Touch on the left and Objective-C Class on the right.  For this view we will make a “credits” page.  So we call it DOCreditViewController, be sure to give it a subclass of UIViewController, and in this case we want to use the GUI so we also add a new xib file, so we check the box, click next and then create:

After this is complete you will see the .h, .m and .xib files in your project. We then add the “credit” information to the xib file by using label objects, I wont go into details here since it has been covered in the past:

Once those labels are added we create an IBOutlet for each so we can access them in the future.  Also because this is a new view and we do have navigation buttons to get from view to view we are going to get to this view by a gesture, we will also need to get back to the parent view with a gesture.  So we make an IBAction that will get us back to parent view.  After we are done our .h file that goes with the new view will have very little code:

We will go into actual implementation in the next section (2 Finger Gesture to change views).

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s