UIPickerView: Get row value while spinning?

前端 未结 3 653
醉话见心
醉话见心 2020-12-11 17:13

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 subclas

3条回答
  •  一向
    一向 (楼主)
    2020-12-11 17:59

    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.

提交回复
热议问题