zoukankan      html  css  js  c++  java
  • UISearchController 的用法[点击搜索框,自动到顶部]

    //在ViewDidLoad里面如下代码

    self.searchViewController = [[UISearchController alloc]initWithSearchResultsController:nil]; self.searchViewController.active = NO; self.searchViewController.dimsBackgroundDuringPresentation = NO; self.searchViewController.hidesNavigationBarDuringPresentation = YES; [self.searchViewController.searchBar sizeToFit]; self.searchViewController.searchBar.barTintColor = kALittleGray; //设置显示搜索结果的控制器 self.searchViewController.searchResultsUpdater = self; //协议(UISearchResultsUpdating) self.searchViewController.delegate = self; self.tableView.tableHeaderView = self.searchViewController.searchBar; self.searchViewController.searchBar.keyboardType = UIKeyboardAppearanceDefault; self.searchViewController.searchBar.placeholder = @"请输入城市关键字";

    遵守协议:

    UISearchBarDelegate,UISearchControllerDelegate,UISearchResultsUpdating

     

     

     

     

    #pragma mark - other delegate

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

        

       

    }

     

    - (BOOL)searchBarShouldEndEditing:(UISearchBar *)searchBar

    {

        return YES;

    }

     

  • 相关阅读:
    1161-飞弹
    1160-繁杂的道路
    JS实现刷新iframe的方法
    ifame 跨域高度自适应
    Asp.net弹出层并且有遮罩层
    Regex.Match 方法
    查询404文件
    JS中showModalDialog 详细使用
    对frameset、frame、iframe的js操作
    HTML & XML 转义字符
  • 原文地址:https://www.cnblogs.com/dongfangchun/p/6244866.html
Copyright © 2011-2022 走看看