views:

187

answers:

2

I have used CustomView.h and CustomView.m from UICatalog sample into my PickerView. But row is not selected/highlighted and scrolled up/down automatically. While the same is happened in standard picker view. How can I select/highlight and scroll up/down automatically with custom view in UIPicker? Thanks.

+1  A: 

I answered a similar question here. Add the following code to your CustomView.m file:

- (void)didMoveToSuperview
{
 if ([[self superview] respondsToSelector:@selector(setShowSelection:)])
 {
  [[self superview] performSelector:@selector(setShowSelection:) withObject:NO];
 }
}

And also add self.userInteractionEnabled = NO to the (id)initWithFrame:(CGRect)frame function. This will allow you to keep the default autoscroll behavior of the UIPickerView.

Christine
A: 

Thanks, this worked fine for me.

Matthew Self