Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to make an iPhone dropdown-looking button

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

like image 416
Rod Avatar asked Jan 20 '23 23:01

Rod


2 Answers

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...

like image 200
gypsicoder Avatar answered Jan 29 '23 19:01

gypsicoder


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

like image 37
Swastik Avatar answered Jan 29 '23 20:01

Swastik