PDA

View Full Version : multiviews using UIView and UIViewController




goldenlife
Jan 10, 2011, 06:32 AM
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.

thanks



dejo
Jan 10, 2011, 09:46 AM
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?
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 (http://developer.apple.com/library/ios/#featuredarticles/ViewControllerPGforiPhoneOS/Introduction/Introduction.html).

pls anybody can suggest any sample app who discribes this following mvc design.
I would think pretty much any sample app from Apple would follow this pattern.

PhoneyDeveloper
Jan 10, 2011, 10:04 AM
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.

goldenlife
Jan 12, 2011, 12:51 AM
Hello,

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

Thanks once again :)