• UISearchController


    UISearchBar   http://blog.sina.com.cn/s/blog_7b9d64af0101dfg8.html

    UISearchController  

    //创建

        self.searchC = [[UISearchController alloc] initWithSearchResultsController:nil];

    //设置代理

        self.searchC.searchResultsUpdater = self;

        self.searchC.delegate = self;

        self.searchC.searchBar.delegate = self;    //然后searchbar的代理方法就可以用了

        self.searchController.searchBar.placeholder = NSLocalizedString(@"UISearchController", @"please add string file"); 

    //设置UISearchController的显示属性,以下3个属性默认为YES
        //搜索时,背景变暗色
        _searchController.dimsBackgroundDuringPresentation = NO;
        //搜索时,背景变模糊
        _searchController.obscuresBackgroundDuringPresentation = NO;
        //隐藏导航栏
        _searchController.hidesNavigationBarDuringPresentation = NO;

        //设置searchbar自适应位置

        [self.searchC.searchBar sizeToFit];

        //设置背景颜色

        self.searchC.searchBar.barTintColor = [UIColor yellowColor];

    //搜索栏的内容发生变化时, 会触发代理方法

    - (void)updateSearchResultsForSearchController:(UISearchController *)searchController;

  • 相关阅读:
    java多线程学习-同步之线程通信
    java多线程学习-同步(synchronized)
    java多线程学习-开篇
    面向对象-多线程-异常机制-查漏补缺
    Sprin2.5+Hibernate3.3+Struts2.0.11集成
    Strut1.3+Sprin2.5+Hibernate3.3集成
    Sprin2.5+Hibernate3.3集成
    Spring学习笔记
    Hibernate学习笔记
    Sping
  • 原文地址:https://www.cnblogs.com/lion-witcher/p/5742760.html
Copyright © 2020-2023  润新知