Reputation: 3172
I have a UIPicker view with multiple components/columns. Is it possible for the components to be different sizes?
Upvotes: 0
Views: 1931
Reputation: 22334
You use the following...
- (CGSize)rowSizeForComponent:(NSInteger)component
Simply return the relevant size for each column (component) via this method. Set your view to be the delegate for the picker and implement the above method.
UPDATE: As pointed out by Dave, I picked the wrong method, I meant to specify the one in the delegate...
– pickerView:widthForComponent:
Upvotes: 2
Reputation: 243156
<UIPickerViewDelegate>
has a method you can optionally implement to define a custom width for a component:
- (CGFloat)pickerView:(UIPickerView *)pickerView widthForComponent:(NSInteger)component
Your UIPickerView
delegate object can implement this to return any number you like. This number will be used as the .width
of the struct returned from -[UIPickerView rowSizeForComponent:]
.
Upvotes: 2