UISearchBar作为标题UITableView

UISearchBar作为标题UITableView,uitableview,uisearchbar,Uitableview,Uisearchbar,如何使UISearchBar在向上滚动时隐藏UItableview并在向下滚动时显示,就像GLIDE-VIDEO TEXT iPhone应用程序一样?试试这个 UISearchBar *temp = [[UISearchBar alloc]initWithFrame:CGRectMake(0, 0, 320, 45)]; temp.barStyle=UIBarStyleBlackTranslucent; temp.showsCancelButton=NO; temp.autocorrection

如何使
UISearchBar在向上滚动时隐藏
UItableview
并在向下滚动时显示,就像GLIDE-VIDEO TEXT iPhone应用程序一样?

试试这个

UISearchBar *temp = [[UISearchBar alloc]initWithFrame:CGRectMake(0, 0, 320, 45)];
temp.barStyle=UIBarStyleBlackTranslucent;
temp.showsCancelButton=NO;
temp.autocorrectionType=UITextAutocorrectionTypeNo;
temp.autocapitalizationType=UITextAutocapitalizationTypeNone;
temp.delegate=self;
YourTable.tableHeaderView=temp;
最后,将TableView添加到ScrollView

[yourScrollView addSubView:YourTableView];

可能对您有帮助

您必须将UISearchBar作为UITableView的标题。即使行与节(如在Glide中)相同或不同,它也可以工作


希望有帮助。

在部分中添加搜索栏。@user3828270如果您可以通过指向外部图片的链接回复此评论,我会将其添加到您的问题中。它确实按照我的预期工作。我希望UISearchBar始终位于UITableView顶部,但向下滚动表格时它不会向下滚动。但当向上滚动时,它将隐藏(在UINavigationBar下)。谢谢!