In this article we create an empty view application and use a uiviewcontroller class to navigate from one view to another. For changing the style of the navigation bar we use code in the view load method of each view. In this I use two views, FirstViewController and SecondViewController.
Open XCode by double-clicking on it.
Create a New XCode Project via click on it.
Now select Empty View Application and click on Next.
Now give your Product Name, Company Identifier and click on Next.
Select the location where you want to save your project to and click on Create.
Now you will see in the XCode Window two Objective-C Classes that were generated by XCode; they are:
Now we add two UIViewController; for this we use the following procedure.
Select the appdelegate.m class and right-click on it, as in:
Choose New File..
Select Subclass of UIViewController from the drop down list and give a class name. Here I use First view controller for the class name. Then click on checkbox with xib use interface. Add a label and button from xib.
Click on next.
Now click on create to import a class into the project, as in:
Repeat Steps to add the Second view controller class.
After that we code for navigation and to do linking.
To change the style of the navigation bar we use the following code:
Now select which platform you want to see output for.
Output 1 in iPhone:
Output 2 in iPhone: