1

Possible Duplicates:
Hiding/ Showing UIPickerView

How to show and hide the uipickerview on button click ?

Community
  • 1
  • 1
Gladiator10
  • 11
  • 1
  • 2

1 Answers1

1

That's not standard behavior for an iOS app, but if you want to do it, I would animate the picker up from the bottom of the screen to the location in which you want it to appear when the button is tapped the first time, and then animate it back down below the screen when the button is tapped again, or something to that effect.

To do this, you would register an action handler on your UIButton using -addTarget:action:forControlEvents:. In your action handler method, check a member variable to determine if the picker is already visible. If the view isn't visible yet, create a new view in a frame that is below the screen, add it to your main view, and animate its frame onto the screen and set your member variable to indicate the picker is visible. The next time the user taps the button, animate the frame of your picker view back offscreen and remove it from your view.

Ryan
  • 16,626
  • 2
  • 23
  • 20