如何在swift中更改UISearcherController行的高度

时间:2016-09-27 20:05:01

标签: ios uitableview search swift2 uisearchcontroller

如何在swift中更改searchController的行高?我已经使用searchController设置了一个tableview,我想让行高度更高一些。那会很棒。

1 个答案:

答案 0 :(得分:-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
    }
}