ckassar 0 Newbie Poster

i am working on a view controller that contains two picker views (FromCur ,ToCur). those picker views are filled by an xml parser . althoughthe NSLog in the Title for row function is not giving me a null answer , the picker views displays a question mark. i have been stuck on this for hours , please help me to find the bug .
my code is the following :

- (void)viewDidLoad
{
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.
    [super viewDidLoad];
    // [super viewDidLoad];
    currencies = [[NSMutableArray alloc] init];
    NSString *url=@"http://192.168.83.1:8080/jeeRestApp-1.0/rest/devise";
    NSXMLParser *parser;
    parser=[[NSXMLParser alloc] initWithContentsOfURL:[NSURL URLWithString:url]];
    parser.delegate=self;
    if ([parser parse]==FALSE){
        UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Erreur" message:@"erreur de connection!" delegate:nil cancelButtonTitle:@"Cancel" otherButtonTitles:nil, nil];
        [alert show];
    }
    self.FromCur=[[UIPickerView alloc]init];
    self.ToCur=[[UIPickerView alloc]init];

    self.FromCur.showsSelectionIndicator = YES;
    self.FromCur.opaque = NO;


    self.ToCur.dataSource=self;
    self.ToCur.showsSelectionIndicator = YES;
    self.ToCur.opaque = NO;
    [self.view addSubview: _FromCur];
    [self.view addSubview: _ToCur];

    [self.FromCur reloadAllComponents];
    [self.ToCur reloadAllComponents];

}




-(NSInteger)numberOfComponentsInPickerView:(UIPickerView *)Cur{
    self.FromCur=Cur;
    self.ToCur=Cur;
     NSLog(@"number of components ");
    return 1;


}


-(NSInteger)pickerView:(UIPickerView *)pickerView numberOfRowsInComponent:(NSInteger)component{
    self.FromCur=pickerView;
    self.ToCur=pickerView;
    NSLog(@"number of rows in component");
    return currencies.count;
}




-(NSString*)pickerView:(UIPickerView *)pickerView titleForRow:(NSInteger)row forComponent:(NSInteger)component{
    _FromCur=pickerView;
    _ToCur=pickerView;
    curr=[currencies objectAtIndex:row];
    NSLog(@"le nom est : %@",curr.nom);
    return curr.nom;

}
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.