Swift 中 UIPickerView 顶部的搜索栏 [英] Search bar at the top of a UIPickerView in Swift

查看:39
本文介绍了Swift 中 UIPickerView 顶部的搜索栏的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以我有一个 textField,当用户按下时,它会显示一个 UIPickerView,它是从一个数组填充的.

So I have a textField, which when the user presses, it shows a UIPickerView, which is populated from an array.

是否可以在pickerView的顶部有搜索栏,以便用户可以在pickerView中搜索内容?

Is it possible for there to be search bar at the top of the pickerView, so the user can search for something in the pickerView?

我以前从未见过这样做过,所以不知道是否有可能?

I've not seen this done before so have no idea if it's possible?

提前致谢.

推荐答案

UIPickerView 实际上是为了几个选项——如果你需要展示有更多选项的东西,我会建议一个带有搜索栏的表格视图.搜索栏教程是一个好的开始.

UIPickerView is really meant for a few options - if you need to present something that has a lot more options, I would suggest a table view with a search bar. Search Bar Tutorial is a good start.

这篇关于Swift 中 UIPickerView 顶部的搜索栏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆