【问题标题】:How can i change the UISearcherController row's height in swift如何快速更改 UISearchController 行的高度
【发布时间】:2016-09-27 20:05:00
【问题描述】:

如何快速更改 searchController 的行高?我已经用 searchController 设置了一个 tableview,我想让行高高一点。那太好了。

【问题讨论】:

    标签: ios uitableview search swift2 uisearchcontroller


    【解决方案1】:
    // swift 2.3
    1. set tableView delegate
    
    tableView.delegate = self
    
    2. implementes the delegate method
    
    extension ViewController: UITableViewDelegate {
        func tableView(tableView: UITableView, 
               heightForRowAtIndexPath indexPath: NSIndexPath) -> CGFloat {
            return 50
        }
    }
    
    // swift 3.0
    1. set tableView delegate
    
    tableView.delegate = self
    
    2. implementes the delegate method
    
    extension ViewController: UITableViewDelegate {
        func tableView(_ tableView: UITableView, 
                      heightForRowAt indexPath:IndexPath) -> CGFloat {
            return 200
        }
    }
    

    【讨论】:

    • 你能用 Swift 2.3 写吗?
    猜你喜欢
    • 2019-04-20
    • 1970-01-01
    • 2018-04-23
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多