Phil
Phil

Reputation: 3045

How to get header view created in Nib to fit section header?

I'm trying to create a header view for my section header for my UITableView by using the 3rd option here

http://hons82.blogspot.it/2014/05/uitableviewheader-done-right.html

I've got it working but my view doesn't fit properly, how can I make it fit? and be dynamic? Do I have to use constraints? but how do I do that if the view is in a separate nib and not in the main storyboard?

Here's a screen shot of the nig

enter image description here

and the problem

enter image description here

Upvotes: 0

Views: 147

Answers (1)

rdelmar
rdelmar

Reputation: 104092

You should have constraints, internal to your view -- that is constraints that fix the position of the search bar and buttons inside your view (which should be a UITableViewHeaderFooterView or a subclass). The view itself will automatically be the width of the table view, and the height should be set by you in tableView:heightForHeaderInSection.

Upvotes: 1

Related Questions