Create a navigation-based application in xcode4.2

Source: Internet
Author: User

No navigation-based application exists in xcode4.2, instead of the master-detailapplication. When we create the application on the iPhone, we can get a navigation application.Program, Which is a uitabelview as the root view, but we prefer the version in the old version.

1. Create a master-detailapplication Program

2. Deleted the uitableview-based controller.

3. Create a mainwindow. XIB File

4. create our own rootviewcontroller, which inherits from uiviewcontroller.

The current project structure should be:

5. Modify appdelegate. h and appdelegate. M.

Appdelegate. h:

# Import <uikit/uikit. h>

@ Interface appdelegate: uiresponder <uiapplicationdelegate> {

Uiwindow * window;

Uinavigationcontroller * navigationcontroller;

}

@ Property (nonatomic, retain) iboutlet uiwindow * window;

@ Property (nonatomic, retain) iboutlet uinavigationcontroller * navigationcontroller;

@ End

Appdelegate. M:

Major changes:

-(Bool) Application :( uiapplication *) Application didfinishlaunchingwitexceptions :( nsdictionary *) launchoptions

{

[Self. Window addsubview: navigationcontroller. View];

[Self. Window makekeyandvisible];

Return yes;

}

6. Modify the mainwindow. XIB File

1) Add an object, window, and navigation controller from the control panel.

2) file's owner

3) object

4) Navigation Controller

Modify the viewcontroller

Add a bar button item to the navigation item.

7. Modify project properties

Last:

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.