PDA

View Full Version : Fill Picker view component in another controller




ITCreative
Aug 15, 2011, 09:14 PM
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:



jnoxx
Aug 16, 2011, 01:55 AM
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.

jiminaus
Aug 16, 2011, 02:04 AM
@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.

ITCreative
Aug 16, 2011, 07:08 PM
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.


- (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