Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
522 views
in Technique[技术] by (71.8m points)

iphone - UIPickerView: Get row value while spinning?

I'd like to get the row value in real-time as the iPhone user spins a wheel in a UIPickerView (not just when the wheel settles onto a particular row). I looked into subclassing UIPickerView then overriding the mouseDown method, but I couldn't get this to work. Any suggestions would be very much appreciated.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Perhaps try implementing the delegate method:

- (UIView *)pickerView:(UIPickerView *)pickerView viewForRow:(NSInteger)row forComponent:(NSInteger)component reusingView:(UIView *)view

You could treat it as a passthrough (just passing back the reusingView parameter) but each time it was called you would know that view was coming on the screen as the user scrolled - then you could calculate how many views offset from this one the center view was.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...