zoukankan      html  css  js  c++  java
  • swift开发笔记06

    // 自定义cell

    class Cell: UITableViewCell {

        

        @IBOutlet weak var fenLei: UILabel!

        @IBOutlet weak var tangGuoMing: UILabel!

        

        

        var mode: Candy!

        {

            didSet {

                updateUI()

            }

        }

        

        fileprivate func updateUI()

        {

            fenLei.text = mode.name

            tangGuoMing.text =  mode.category

        }

        

    }

    // prepare

        override func prepare(for segue: UIStoryboardSegue, sender: Any?) {

            let vc = segue.destination as! UINavigationController

            if  let index = myTableView.indexPathForSelectedRow {

                let candy: Candy

                if searchController.isActive {

                    candy = filterCandies[(index.row)]

                } else {

                    candy = arrMode[(index.row)]

                }

                let detail = vc.topViewController as! ViewController

                detail.mode = candy

            }

            

            

        }

     

    // searchController初始化

        func setSearchController() -> Void {

            searchController.dimsBackgroundDuringPresentation = false

            definesPresentationContext = true

            myTableView.tableHeaderView = searchController.searchBar

            searchController.searchBar.scopeButtonTitles = ["All", "Chocolate", "Hard", "Other"]

            searchController.searchBar.delegate = self

            searchController.searchResultsUpdater = self

        }

     

        func updateSearchResults(for searchController: UISearchController) {

            let searchBar = searchController.searchBar

            let scope = searchBar.scopeButtonTitles![searchBar.selectedScopeButtonIndex]

            filterContentForSearchText(text: searchBar.text!, scope: scope)

        }

        

        func searchBar(_ searchBar: UISearchBar, selectedScopeButtonIndexDidChange selectedScope: Int) {

            filterContentForSearchText(text: searchBar.text!, scope: searchBar.scopeButtonTitles![selectedScope])

        }

  • 相关阅读:
    (转)ASP.NET(C#)FileUpload实现上传限定类型和大小的文件到服务器
    JavaWeb多文件上传及zip打包下载
    使用NeatUpload控件实现ASP.NET大文件上传
    jq+download+文件夹下载
    php大文件下载支持断点续传
    大文件断点上传 js+php
    JavaWeb实现文件上传下载功能实例解析
    【Java】Java批量文件打包下载zip
    Java实现FTP批量大文件上传下载篇1
    PHP之路——大文件上传
  • 原文地址:https://www.cnblogs.com/dengchaojie/p/7346645.html
Copyright © 2011-2022 走看看