I'm working with a Today Extension, displaying a UITableView
. There are only a couple of items, but I get empty rows as well.
I'm able to use Auto Layout with an outlet constrain on the table view height to resize the table to fit only the rows with content.
What I'm not able to do is make the widget resize to wrap the table view. At the moment I'm left with a properly sized table and a lot of empty space.
If you want the widget's controller to be the height of the tableView, do this:
self.preferredContentSize = self.tableView.contentSize;
You should set this each time you reload your data of the tableView and the height would change. You don't have to worry about the contentSize's width because the system ignores it.
To correct your answer above, you would need to add:
self.view.translatesAutoresizingMaskIntoConstraints = NO;
That should fix the constraint warnings.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With