简体   繁体   English

Xcode-iOS8的搜索栏

[英]Xcode - Search bar for iOS8

For my tableview I want to include a Search bar. 对于我的tableview,我想包括一个搜索栏。 I searched for it, how I can do that, but the only thing I found, was tutorials for iOS 7. Thats with newer versions not compatible. 我进行了搜索,找到了解决方法,但唯一发现的是iOS 7教程。这与较新版本不兼容。

Do anyone have a tip or code, how can I do that? 有人有提示或代码吗,我该怎么办?

You can always set your own UISearchBar and add it as subview to the navigation controller. 您始终可以设置自己的UISearchBar并将其作为子视图添加到导航控制器。 It will work also for iOS8. 它也将适用于iOS8。

  UISearchBar *customizeSearchBar = [[UISearchBar alloc] initWithFrame:...];
  customizeSearchBar.delegate = self;

  [self.navigationController.view addSubview:customizeSearchBar];

This is just an example I found : http://jduff.github.io/2010/03/01/building-a-searchview-with-uisearchbar-and-uitableview/ 这只是我发现的一个示例: http : //jduff.github.io/2010/03/01/building-a-searchview-with-uisearchbar-and-uitableview/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM