有没有一种方法UISearchController可以让我使用故事板UISearchBar?我有一个带有导航栏的故事板 UI,其中包含我的搜索栏。如果我能保持这种方式就好了,因为以编程方式设置布局真的很不方便。我知道旧的UISearchDisplayController可以故事板。有没有办法用 UISearchController 做类似的事情?
我在带有搜索栏的 tableview 控制器中有一个 tableview。我想以这样的方式在它的顶部添加一个图像,它就像一个导航栏并且不会移动并且基本上缩小了表格视图。我通常使用视图控制器并将图像添加到顶部,但我似乎无法执行 tableviewcontroller。我尝试添加一个 UIView 并调用
tableViewHeader  
方法,但是我的搜索控制器消失了,当我在 tableview 中向下滚动时,标题消失并且 tableview 覆盖整个页面。
有什么方法可以在 tableviewcontroller 中向 tableview 添加某种粘性标题,以便它留在那里并且我的搜索控制器不会消失。
我是 Swift 新手,想知道是否有可能将 UIsearchcontroller 放置在 navgationtitle 中,并通过位于 navigationRightItem 的按钮隐藏和取消隐藏 uisearchcontroller。我见过很多将 UISearchBar 从对象库放置到 navigationTitle 的示例,但没有 uisearchcontroller 的示例。有些人甚至说对象库中的 UISearch bar 已从 ios10 Swift 中弃用。请澄清弃用以及为什么我应该避免使用对象库中的 UISearchBar。哪一种是用于 firebase tableview 搜索的最佳实践。如果您能提供代码示例,我将很高兴。先感谢您。
我在导航控制器上以编程方式更改我的搜索栏设计时遇到问题。我只想使搜索栏曲线如下图所示:
我在堆栈溢出中尝试了很多示例,但我仍然无法改变形状。这是现在的样子:
这是源代码,关于已经完成的内容:
//MARK for searchBar UI
    searchController.dimsBackgroundDuringPresentation = false
    searchController.hidesNavigationBarDuringPresentation = false
    searchController.searchBar.placeholder = " Search for programs..."
    searchController.searchBar.sizeToFit()
    searchController.searchBar.isTranslucent = false
    searchController.searchBar.backgroundImage = UIImage()
    searchController.searchBar.delegate = self
    navigationItem.titleView = searchController.searchBar
    self.searchController.searchBar.layer.cornerRadius = 20.0
    self.searchController.searchBar.clipsToBounds = true
    // SearchBar text
    let textFieldInsideUISearchBar = searchController.searchBar.value(forKey: "searchField") as? UITextField
    textFieldInsideUISearchBar?.borderStyle = .roundedRect
    textFieldInsideUISearchBar?.font = textFieldInsideUISearchBar?.font?.withSize(14)
现在,我真的不知道如何更改它,提前致谢。
uisearchbar uinavigationitem swift uisearchcontroller programmatically
UISearchController在iOS 8中集成时,我收到此警告.我不在项目中使用storyboard.
Presenting view controllers on detached view controllers is discouraged when using UISeachController iOS 8
我正在Xamarin.Ios中使用UISearchController,并且一切正常,但是当我开始键入内容时,未覆盖SearchhResultUpdating方法不会触发。它有时可以正常运行,而其他时候则无法进行监听,但是现在根本不起作用。
这是SearchResultsUpdating类:
class SearchResult : UISearchResultsUpdating
{
    public event Action<string> UpdateSearchResults = delegate { };
    public override void UpdateSearchResultsForSearchController(UISearchController searchController)
    {
        this.UpdateSearchResults(searchController.SearchBar.Text);
    }
}
这是我使用它的时间:
 var searchresult = new SearchResult();
 searchresult.UpdateSearchResults += searchResultsController.Search;
 var searchController = new UISearchController(searchResultsController) { SearchResultsUpdater = searchresult };
ios ×3
uisearchbar ×3
swift ×2
ios8 ×1
search ×1
swift3 ×1
uiimageview ×1
uikit ×1
uistoryboard ×1
uitableview ×1
xamarin.ios ×1