Use multiple views in an application


I am new to Iphone programming. So please don't mind if I ask some basic questions. 😡

I want to develop an application where the landing screen will be a login screen and after login application should display a new screen with the list of available categories. And on selecting any category a new screen should appear with the information related to the selected category.

Basically I want to display different screens in the applications and my confusion is how can I make different screens with one .xib file? or should I use different .xib files for each screen. If I use different .xib files for each screen then how should I navigate to different screens.

Please help in solving this confusion.

Thanks in advance


Best Solution

You should definitely use different .xib's for each view. You will end up having a standard view, a table view (probably programatically wrapped in a navigation controller) and a standard view, respectively. Each will also have their own class.

You navigate to different screens by programmatically initializing them. The condition on which they are created varies from screen to screen. For example, your login screen will only create and load a table view for the categories after a successful login. The category screen will only create a detail screen when the user touches a category in the table.

I think your best bet is to pick up an iPhone programming book and do the first few chapters until you feel comfortable with the basics of XCode. The Apple documentation usually contains more than you really need to know and by the sounds of it, you just want to jump in and make a few simple apps.

After that, you can look at the Apple sample code here:

Related Question