首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >没有搜索栏的UITableView中的筛选选项

没有搜索栏的UITableView中的筛选选项
EN

Stack Overflow用户
提问于 2015-09-07 09:56:49
回答 1查看 234关注 0票数 0

我想添加一个过滤选项,如在iPhone联系人->最近,它有两个过滤器,说全部和错过。我想说的都是今天,过去和即将到来的。

所有可用的例子都是在其中使用搜索栏,但我不需要搜索栏。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2015-09-07 10:09:41

简单,只需使用分段控件与您的3个值。

然后将段连接到值更改的操作。就像这样

代码语言:javascript
运行
复制
@IBAction func filterTable(sender: UISegmentedControl) {
    if sender.selectedSegmentIndex == 0 {
        //User selected today! Filter the table for it
    }
    else if sender.selectedSegmentIndex == 1 {
        //User selected past! Filter the table for it
    }
    else {
        //User selected upcomming! Filter the table for it
    }
}
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/32435818

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档