Take the 2-minute tour ×

Is it possible to prevent the scroll of second component in UIPickerView when first component is still scrolling? I.e. let user to scroll only one component at a time.

If it is, what do you recommend to do?

share|improve this question
add comment

2 Answers

up vote 1 down vote accepted

Probably the easiest way to do this is to to overlay the picker with a transparent view that can essentially discard touch events while the picker is scrolling. I believe you will need to invent an algorithm to determine if the picker is scrolling - for instance, is your dataSource getting asked for information about some section.

When you get this message: didSelectRow: then you know the scrolling has stopped.

In the transparent view, you will need to essentially overlay the picker, and only let events pass that are overtop the active segment. I have not done this in particular but have read about others doing it. You should be able to find instructions on "eating" or "passing" event on this site or in the Apple documents on iOS Events.

Also, if it were me, I'd add three semi-transparent views to the transparent view, and color each a small bit of a different color, so you can determine if you have the overlays properly segmented (ie each section is properly over the segment you want to block).

share|improve this answer
add comment

You will have to sublcass UIScrollView and override the touchesShouldBegin and touchesShouldCancelInContentView methods.

Then you can have several options easiest being set a bool variable to false if one is moving and and in the touches should cancel if that bool is false return true.

Thats how I would do it anyways.

share|improve this answer
add comment

Your Answer


