4

I've seen a dropdown-like button on many apps, including Turf Wars, that simulates a dropdown with a picker. I need to use the same functionality in my app, but I'm not too sure what the best way to go about it may be.

Example:
Here's an example I found online.

I figured I could make two images and set them as a UIButtons background image for the different states and have the button open a pickerview.

Any input would be appreciated.

Rod

Community
  • 1
  • 1
Rod
  • 789
  • 7
  • 19

2 Answers2

7

You can use a button with the image like dropdown image. And you can place a picker over that button hidden. In the click event you will show the picker. And after selection on picker you have to update the text value of the button and hide the picker again. Hope it helps you...

gypsicoder
  • 5,416
  • 5
  • 24
  • 38
2

You can use a pop over that has picker in it.You can use use different images as UIButton background as you mentioned.It will give a feel of dropdown button.You can show popover on button action

Swastik
  • 2,415
  • 2
  • 31
  • 61
  • @Rod is asking about iPhone,not iPad, There is no PopOverController in iPhone – Ajith Dec 01 '10 at 07:37
  • 1
    @Aji Thanx! I just forgot that.Was there any need to downvote the answer.Though this concept does not work for iPhone.May be useful to anyone else who is doing it for iPad – Swastik Dec 01 '10 at 09:30
  • It is somewhat misleading as the answer has not accepted yet. – Ajith Dec 01 '10 at 09:48
  • @Aji, I really dont agree with your justification for downvoting the answer.I dont think its fair – Swastik Dec 01 '10 at 09:50
  • I voted the answer up again based on sherry's justification, but I think you're both giving me a lot more credit than the question deserved (or maybe I just didn't explain it well; sorry). I'm fine with just popping up a picker after they click on the button, but I just wasn't sure how to set up the button itself (e.g. button with background image and uitextview to show the picked text over the button again?). Just not sure what the best way would be to reflect the user's pick over the button and how to set up the image to look like a button (I know that much now). Thanks for the help! – Rod Dec 03 '10 at 09:00
  • +1 for UIPopOverController. Didnt even know this existed and it fits me perfect. – Martin Berger Nov 30 '12 at 13:35