App planning guidence needed

Discussion in 'iOS Programming' started by appkov, Nov 27, 2009.

  1. macrumors newbie

    Nov 27, 2009

    I am new to programming and want to begin to plan out a simple app. I have a question about how to best go about it. View Based, Navigation based etc.

    The idea would best be described as a type of "magazine". Each "page" is unique in that it presents different information, images and buttons with different actions.

    What is the best practice method for dealing with multiple unique views?
    If I have 25 views that have unique content and functionality, do I create 25 unique classes with a view controller for each?

    Many thanks
  2. macrumors regular


    Jun 22, 2009
    Well to create different view with different actions, etc. you only need one .xib file. Then you just drag and drop as many view as you want from the library. Then select the view and click "File->Write Class Files" to write the class files for the view. Inside the header file you can define whether it is a UIView, UIViewController, etc.
  3. thread starter macrumors newbie

    Nov 27, 2009
    Thanks for your response. I really appreciate it. So are you saying that for 25 "pages" I need 25 separate classes with a controller for each one?

  4. macrumors member

    Mar 18, 2008
    Lisbon, Portugal
    Yes, each UIViewController can only have one view. But you can have views without view controllers (buttons, text areas, etc...), so if you don't have a reason to use a UIViewController (for example if you don't need it's callbacks) don't use it. Just create the views and keep them on your MainManager object (something like that).
  5. thread starter macrumors newbie

    Nov 27, 2009
    Thanks very much for the help. I thought that was the case. So for someone who would want to do...let's say an alphabet, they would need 26 classes and view controllers, one for each "page", and if the pages had flip sides, they would need a total of 52? It seems very unwieldy?

  6. macrumors regular


    Jun 22, 2009
    Well, it is and then again it isn't. If each view is similar, say they each share the same attributes such as a title and description and you just want to change those attributes, you would just make them IBOutlets and change them in the code (all in one view). However, if your views are extremely different the most common way is to create them each different view. Your welcome by the way :)
  7. thread starter macrumors newbie

    Nov 27, 2009
    You've been very kind. I'm going to do some experimenting...


  8. macrumors 6502

    Oct 31, 2007
    San José
    Read the documentation. That is the best way. Are you new to programming for UIKit, or are you new to programming in general?

    If you have programming experience, but are new to UIKit, make sure to read:

    iPhone Human Interface Guidelines
    iPhone Development Guide
    iPhone OS Technology Overview
    iPhone Application Programming Guide
    View Controller Programing Guide for iPhone OS

    If you don't have Mac programming experience, you also want to read:

    The Objective-C Programming Language
    Cocoa Fundamentals Guide
    Cocoa Design Patterns

    If you don't have any programming experience, find a good book on the C Programming Language and read that.

    That documentation should give you plenty of answers about how to design your application. If you are coding twenty different view controller classes for twenty different views, you might not be working as efficiently as you should.
  9. thread starter macrumors newbie

    Nov 27, 2009

    Thanks for taking the time to answer. I'm coming from Flash.

    Reading the books and doing the tutorials. And asking basic questions on the forums...

    I do appreciate the advice.


Share This Page