multiviews using UIView and UIViewController

Discussion in 'iOS Programming' started by goldenlife, Jan 10, 2011.

  1. goldenlife macrumors newbie

    Oct 2, 2010
    Hi All,

    I am implementing application which has multiviews, and I am doing this without using Navigationcontroller or Tabbarcontroller.

    so I implemented 4-5 views which is inherited from UIView and in Appdelegate calling this view accordingly.. so removing currentview and adding new view on window (window addsubview: myview) while loading new view.

    this works fine..but here I didnt use view controller.
    and if I want to follow MVC pattern, then how do I implement using UIviewController and UIView both?
    if for different module I want to use one viewcontroller then how many view I can implement and how can I switch those view with that one viewcontroller
    or should I use only viewcontroller?

    pls anybody can suggest any sample app who discribes this following mvc design.

  2. dejo Moderator


    Staff Member

    Sep 2, 2004
    The Centennial State
    The normal guideline is one view per viewcontroller. And there are basically two ways to present new views via a viewcontroller: modally and pushed onto a navigation controller stack. Make sure you have a read through the View Controller Programming Guide for iOS.

    I would think pretty much any sample app from Apple would follow this pattern.
  3. PhoneyDeveloper macrumors 68040


    Sep 2, 2008
    In many cases using a navigation controller with a hidden navbar will give you the appearance that you want as well as the apis to add and remove views from the screen.

    If you don't use one of Apple's root view controllers (nav, tab, splitview) you are likely to end up with unsolvable problems. The usual issues are problems with rotation and with modal views.
  4. goldenlife thread starter macrumors newbie

    Oct 2, 2010

    Thanks for your reply. Ya I have started my app using NavigationController with hiddenbar =yes.

    Thanks once again :)

Share This Page