I placed an UIImageView
at the right side of a table view cell and added a trailing constraint to the cell of 20.
Yet the image ends all the way at the left of the cell when I run the app.
My table view controller code is very basic:
override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell
{
let cell = tableView.dequeueReusableCell(withIdentifier: "SailboatCell", for: indexPath) as! SailboatTableViewCell
return cell
}
The identifier is correct and I also set the class of cell.
I've done auto layout a lot and have no idea what I could be missing here.
On a device the images are on the right side when the app starts but end up on the left on newly created cells when I start scrolling. Things reset themselves a bit when I put the device in landscape and then portrait again.
No auto layout warnings are printed.
Earlier I had other UI elements on the cell that were nicely placed (left-to-right) as expected. Only the image view acted weird. I deleted all other UI elements to avoid any interference.
EDIT: I've recreated the cell and all is fine know. No idea what is was.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…