【问题标题】:Navigable UITableView section footers in iOS?iOS中可导航的UITableView部分页脚?
【发布时间】:2013-06-08 04:06:15
【问题描述】:
我想实现一个类似于现有应用中的“登录”表单,例如:
截图来自 Twitter 和 Dropbox。 “忘记密码?”选项是可点击的,它导航到另一个视图。我想做类似的东西,但我不确定这样的“忘记密码?” text 是分组UITableView 的页脚:我一直在文档中搜索是否可以在页脚中启用用户交互,但我找不到任何相关信息。或者可能是UILabel?我该怎么做?
谢谢!
【问题讨论】:
标签:
ios
footer
user-interaction
uitableview
【解决方案1】:
你可以重写- (UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section方法
在那里,您可以使用标签、按钮或任何您需要的东西创建视图。- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section 的标题同样适用
【解决方案2】:
实现委托方法
- (UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section
然后创建带有“忘记密码”标题的 UIButton,将其作为子视图添加到 UIView 并将该视图作为页脚视图返回。