仅当用户下拉表时才显示搜索栏 [英] Showing the searchbar only when user pull down the table

查看:97
本文介绍了仅当用户下拉表时才显示搜索栏的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个表视图,顶部有一个搜索栏。我的要求是当有人打开页面时,不显示搜索栏,但是当有人向下滑动表格时,搜索栏应该可见。

I have a table view with a search bar on top of it. My requirement is to do not show the search bar when someone open the page but when someone slides the table down then the search bar should be visible.

推荐答案

在控制器的 viewDidAppear:方法中,设置表视图的contentOffset属性(在UIScrollView中)以隐藏搜索栏。

In your controller's viewDidAppear: method, set the contentOffset property (in UIScrollView) of your table view to hide the search bar.

- (void)viewDidAppear:(BOOL)animated{
    [super viewDidAppear:animated];    
    self.tableView.contentOffset = CGPointMake(0, SEARCH_BAR_HEIGHT);
}

这篇关于仅当用户下拉表时才显示搜索栏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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