UIPickerView selectedRowInComponent: returns stale data after code adjusts it
Posted
by Eric Lloyd
on Stack Overflow
See other posts from Stack Overflow
or by Eric Lloyd
Published on 2009-07-10T05:04:25Z
Indexed on
2010/05/10
23:24 UTC
Read the original article
Hit count: 568
uipickerview
I have a UIPickerView
with multiple components. Some values are grayed out, and my pickerView:didSelectRow:inComponent
honors this by shifting the picker component in question to the nearest valid value, much as UIDatePicker
moves from "30" to "28" when you select "February". Then it calls a delegate method to announce the adjusted value.
When my adjuster method calls my UIPickerView
's selectRow:inComponent:animated:YES
, the value on screen is correct, but the values from selectedRowInComponent:
are stale (from before the adjustment for gray values). However, if I call selectRow:inComponent:animated:NO
, the returned values are correct, but the lack of animation is jarring.
I've tried wrapping the adjustment in a beginAnimations:
/commitAnimations
block and catching the values in UIView
's +animationDidStopSelector
, but I still get stale values. Has anyone run into this before?
© Stack Overflow or respective owner