Reputation: 5829
In my storyboard I have a UITableView
and above the dynamic cells I added a UIView
to keep there a photo and some labels.
Currently, I want to apply constraints to the photo so that it reaches the top, left and right side of the screen and keeps the aspect ratio. However, the storyboard looks like this:
The constraints for photo are:
However, as you see, the constraints are marked in red and when I run the app the photo is not stretched properly.
What is causing this issue?
Upvotes: 0
Views: 57
Reputation: 573
I would probably do this programmatically. It is pretty simple to create a custom view and set it as your header view. You can either create a UIView with a UIImageView inside of viewForHeader
or by assigning it to the entire table with tableView.tableHeaderView = headerView
.
Upvotes: 1