How hide view Controller

Discussion in 'iPhone/iPad Programming' started by ITCreative, Aug 14, 2011.

  1. macrumors member

    Joined:
    Aug 4, 2011
    #1
    My project is View based and contain 3 controller ,


    the first controller contain picker view if user select item from it.


    the second controller display.


    and the second controller contain button when user touch inside this button


    the three controller display.




    Now my problem I want hide the first controller when the second display


    hint : the first controller is UIViewController




    and SecondController is UINavigationController






    How hide view Controller ? becouse when secondController display I show in header part of firstController :(
     
  2. macrumors 6502

    Joined:
    Jul 4, 2009
    #2
    Can you supply more details on how you have your view hierarchy set up, as well as some code or the project? Then tell us what you have tried to do, and the outcome.
     
  3. thread starter macrumors member

    Joined:
    Aug 4, 2011
    #3
    Thanks a lot





    [​IMG]
    when secondcontroller display, in header show part of firstController








    also when touch up inside on button choice1 to display threeController the problem still display




    [​IMG]





    So I want hide the controller before another controller display How do this ? :confused:
     
  4. macrumors 603

    ArtOfWarfare

    Joined:
    Nov 26, 2007
    #4
    I'm just going to mention that you show and hide views, not controllers.

    So it might look something like this:

    viewController.view.hidden = YES;

    Not like this:

    viewController.hidden = YES;

    Not really sure if that helps at all.
     
  5. thread starter macrumors member

    Joined:
    Aug 4, 2011
    #5

    Thanks a lot :eek:

    I try it but when select item from picker view in firstController the white screen display not secondController :confused:


    Code:
    - (void)pickerView:(UIPickerView *)pickerView 
    	  didSelectRow:(NSInteger)row 
    	   inComponent:(NSInteger)component
    {
    
    	UINavigationController *navigController = [[UINavigationController alloc] init];
    	[self.view addSubview:navigController.view];
    
    	switch (row){
    
    		case 0: 
    			break;
    
    		case 1: 
    			self.view.hidden = YES;
    
    			[secController displayMenu:1];
    
    			secController = [[SecondViewController alloc] init];
    
    			break;
    
    		case 2:	
    			self.view.hidden = YES;
    
    			[secController displayMenu:2];
    			secController = [[SecondViewController alloc] init];
    			break;
    
    	
    :
    :
    :
    :
    :
    ect
    
    
    
    
     
  6. macrumors 68030

    PhoneyDeveloper

    Joined:
    Sep 2, 2008
    #6
    Your life will be easier if you use the navigation controller for all your views. Start with the navbased app template. Then use pushViewController:animated: to make your additional view controllers appear.

    Many, many apps work like this.
     
  7. thread starter macrumors member

    Joined:
    Aug 4, 2011
    #7



    Thanks a lot :eek:


    but How can hide the row in navigation project because i want use picker view
     
  8. macrumors 68030

    PhoneyDeveloper

    Joined:
    Sep 2, 2008
    #8
    If I understand your question, if there is a picker view on the rootViewController it will be covered up when you push the second view controller.
     

Share This Page