UIPicker losing values?

Discussion in 'iOS Programming' started by stephanos180, Dec 21, 2010.

  1. stephanos180 macrumors member

    Joined:
    Aug 23, 2006
    Location:
    Downey, CA
    #1
    Hello, everyone. I've got a noob question for you. I'm working on a custom-made picker which resembles the one in the iPhone Clock application (Timer). I've essentially recreated it, complete with animations, but included seconds. I'm running into a problem, though... that values are lost if I move more than one wheel at a time. That is, if I scroll one component wheel and move another before the first settles, a change is only registered in the second component. I suspect that this has something to do with the animations. Any suggestions?
     
  2. flummoxed macrumors member

    Joined:
    Nov 27, 2010
    #2
    Your explanation is a bit vague, but it sounds like a problem I discovered when displaying images in UIPicker.

    I discovered that you have to use discreet instances of the data you are displaying in each picker. You cannot recycle the same object.

    I was assigning the same imageView to 3 different picker columns.
    When I turned any of the 3 pickers, or all of them, any image that was displayed in more than one picker would disappear from the other pickers.

    The solution was to assign new instances of the imageView with the same image to different pickers.
     

Share This Page