UIPickerView selectedRowInComponent: returns stale data after code adjusts it
- by Eric Lloyd
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?