使用iOS SDK将UITableView呈现为下拉列表 [英] Present a UITableView as drop-down list using the iOS SDK
本文介绍了使用iOS SDK将UITableView呈现为下拉列表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想在iPhone应用程序中实现一个下拉列表,就像您在选择PDF/Books时在iBooks中看到的一样.
I want to implement a drop-down list in an iPhone application, the same like you might have seen in iBooks when you select PDFs/Books.
我对如何实现它有一点想法,如果我错了,请纠正我:
I have a slight idea how to implement it, just correct me if I am wrong:
- 创建按钮
- 在按钮的单击事件上定义一个
CGRect
,并在CGRect
内绘制一个LoadTableView
- 在运行时加载
TableViewData
.
- Create the button
- On a click event of the button define a
CGRect
and within theCGRect
draw aLoadTableView
- Load
TableViewData
at runtime.
那是正确的吗?如果没有,该怎么办?
Is that correct? If not, how should I do it?
推荐答案
这是一种更好/更轻松的方法.
Here's a much better/easier way to do it.
- 创建自定义UITableViewController和关联的笔尖.使用此类封装您的tableView和数据.
- 当用户单击您的按钮时,实例化您的自定义视图控制器,并使用presentModalViewController:animated对其进行模态显示
- 用户从弹出视图中选择了一个选项后,请返回结果的父视图.
- 使用dismissModalViewControllerAnimated关闭表视图:
这就是iBooks对高度自定义的UITableViewController所做的事情.
This is what iBooks does with a highly customized UITableViewController.
这篇关于使用iOS SDK将UITableView呈现为下拉列表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文