0

In my iPhone app I have a UIPickerView with 2 columns.

When the user has clicked on the right column and selected an item, they then click a button. After this I want the left hand columns of the UIPickerView to be selected again.

I can select any row in a column (component) by using

[myPickerView selectRow:myRow inComponent:myComponent animated:YES];

Is there any way I can select the column itself ?

Thanks

arossco
  • 77
  • 1
  • 7
  • It's not clear what you're looking for or what problem you're having. –  Nov 19 '10 at 13:42
  • what does it mean to select a the column? AFIK the picker control doesn't have a UI state for "column selection". – TomSwift Nov 19 '10 at 16:20
  • My picker is designed so that the split between the columns is variable; when working on the left column this column is wide, and the right column is narrow so that only part of the contents are visible.When clicking on the right column the left column is made narrow and the right column is widened so the contents can be seen fully. After processing the user input I want to widen the left column again via code. ( i.e. simulating a click on the left column – arossco Nov 19 '10 at 18:41

1 Answers1

0

Looking at the problem again (after a night's sleep !) I realised that I was looking at the wrong problem; what I really want to do is resize the columns to their initial state.

I can do this by using the following code

 self.pickerView.delegate = nil;
 self.pickerView.delegate = self;

with the resizing code in

-(CGFloat)pickerView:(UIPickerView *)pickerView widthForComponent:(NSInteger)component
{ ...
}

Thanks to Kovpas for the solution

Community
  • 1
  • 1
arossco
  • 77
  • 1
  • 7