Fill Picker view component in another controller

Discussion in 'iOS Programming' started by ITCreative, Aug 15, 2011.

  1. ITCreative, Aug 15, 2011
    Last edited: Aug 16, 2011

    macrumors member

    Joined:
    Aug 4, 2011
    #1
    my project contain two view Controller and both contain Picker view

    but i want when user select item from picker view in first controller

    the anther picker view in second controller fill component depend on which user

    select in the first .


    How can do this :confused:
     
  2. macrumors 65816

    jnoxx

    Joined:
    Dec 29, 2010
    Location:
    Aartselaar // Antwerp // Belgium
    #2
    Save the one you choose in the first one, in the second, read this out, and make a switch case to fill the picker based upon certain string from first picker.
     
  3. macrumors 65816

    jiminaus

    Joined:
    Dec 16, 2010
    Location:
    Sydney
    #3
    @ITCreative Please stop going overboard with the fonts and colours. It will not get you any more help. In fact, it might put people off reading your thread.
     
  4. thread starter macrumors member

    Joined:
    Aug 4, 2011
    #4
    Thanks a lot for all


    I try it but when i select item from piker view in first controller

    the white screen display without any thing.

    Code:
    - (void)pickerView:(UIPickerView *)pickerView 
    	  didSelectRow:(NSInteger)row 
    	   inComponent:(NSInteger)component
    {
    	
    	switch (row){
    			
    		case 0: 
    			break;
    			
    		case 1: 
    			NSString *myfile = [[NSBundle mainBundle] pathForResource:@"list" ofType:@"plist"];
    	Names =[[NSArray alloc] initWithContentsOfFile:myfile];
    			[self presentModalViewController:secondController animated:YES];
    			break;
    			
    		case 2:
    	NSString *myfile = [[NSBundle mainBundle] pathForResource:@"menu" ofType:@"plist"];
    	Names =[[NSArray alloc] initWithContentsOfFile:myfile];
    			[self presentModalViewController:secondController animated:YES];
    			break;
    		:
    :
    ::
    etc 	
    
    
    Note : the picker view in the second screen dataSource & delegate link to

    Second Controller and fill component from plist
     

Share This Page