Chapter 32: Search Bar Height


This is probably a very silly question but anyways…

When selecting the search bar in the StoryBoard, the height shown is 51 points (this is also the value used when setting the tableView contentInset

tableView.contentInset = UIEdgeInsets(top: 51, left: 0, bottom: 0, right: 0)

Screenshot 2021-10-25 at 19.03.32

But when getting the height using searchBar.bounds.height, the result is 56 instead:

print("Search bar height: \(searchBar.bounds.height)")
// => Search bar height: 56

Where are those extra 5 points coming from?


This topic was automatically closed after 166 days. New replies are no longer allowed.