如何以编程方式添加文本字段和按钮?
我有一个 tableView,我想在 tableView 上应用搜索功能。为此,我需要 textField 和搜索按钮,但我不知道如何以编程方式创建它们。所以请告诉我如何创建这两个工具。
谢谢。
I have a tableView and I want to apply search facility on tableView. For that I require textField and search Button but I don't know how to create these programmatically. so plz tell me how to create these two tools.
thanx.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
尝试使用以下链接描述异步滚动条示例
http://blog.patrickcrosby.com/2010/04/27/iphone-ipad-uisearchbar-uisearchdisplaycontroller-asynchronous-example.html
但您也可以参考之前的帖子
UISearchBar 示例代码
有关在键入时实现和获取结果的更多方法,请转到 apples 文档并参考<一个href="https://developer.apple.com/library/ios/#documentation/UIKit/Reference/UISearchBarDelegate_Protocol/Reference/Reference.html#//apple_ref/occ/intf/UISearchBarDelegate" rel="nofollow noreferrer">UISearchBarDelegate协议方法
Try with the following link which describes for asynchronous scrollbar example
http://blog.patrickcrosby.com/2010/04/27/iphone-ipad-uisearchbar-uisearchdisplaycontroller-asynchronous-example.html
But you can also refer the previous post
UISearchBar Sample Code
For more methods of implementing and getting results as you type, go to apples document and refer UISearchBarDelegate Protocol Methods
这是 UITextField 的文档和UIButton。您可能还会发现 UISearchBar 很有用,其中包含文本字段和按钮。
将您的视图添加到表视图的标题视图中。
Here's the documentation for UITextField and UIButton. You might also find UISearchBar useful, which incorporates both a text field and a button.
Add your views to the table view's header view.
您有一个表委托
tableview:cellForRowAtIndexPath
。在此委托中添加以下代码。您还可以为按钮添加事件,例如
“谢谢”
You have a table delegate
tableview:cellForRowAtIndexPath
. In this delegate add the following code.Also You can add event for button like
Thanks