How do I pop up a UIPickerView (which is not on the screen) with a button click? I can't find any sources online which do this.
if you want to popUp pickerview on button click ... you can use uitextfield instead of uibutton .... in ViewDidload just set uitextfield inputview as pickerview and in In textfield Didbeginediting set textfield tint color as Clearcolor.
Try this, Hope it Helps.
Follow these steps...
create a UIView in a view controller in the main.storyboard file and add a UIPicker view inside it.
connect the view and the picker view to the viewController.swift with a IBOutlet
in the ViewDidLoad method, hide the the uiview we created.
when the button is clicked, unhide the uiview you created, and get the user input.
Here is an example...
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.