0

I'm using UIpickerview in my app. The problem is that my pickerview titleforrow function always return 3 rows although numberofRowsinComponent return more rows.

- (NSInteger)pickerView:(UIPickerView *)pickerView numberOfRowsInComponent:
    (NSInteger)component {

return [filteredTerms count]; }


- (NSString *)pickerView:(UIPickerView *)pickerView titleForRow:
    (NSInteger)row forComponent:(NSInteger)component {


CreateOrder *order =  [filteredTerms objectAtIndex:row];

NSString *title;
title = order.kBranchName;

return title;   }   

I've even tried to hard code the number or rows returned, but it is not working. The titleforrow row always start from 2.

HaskellElephant
  • 9,819
  • 4
  • 38
  • 67
sicKo
  • 1,241
  • 1
  • 12
  • 35

1 Answers1

2

Try this

- (NSString *)pickerView:(UIPickerView *)pickerView titleForRow:(NSInteger)row forComponent:(NSInteger)component
{

return [filteredTerms objectAtIndex:row];

 }
Aman Aggarwal
  • 3,754
  • 1
  • 19
  • 26