Newbie Questions
Newbie Questions

Reputation: 463

How can i change the UISearcherController row's height in swift

How to change searchController's rows height in swift? I have set up a tableview with searchController and i would like to make the rows height a bit higher . That would be great.

Upvotes: 0

Views: 57

Answers (1)

John Lee
John Lee

Reputation: 114

// 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
    }
}

Upvotes: -1

Related Questions