Nick89 Nick89 - 3 years ago 160
Swift Question

Why is my Image not displaying images as I've specified - In Swift

So I have a

PFQueryTableViewController
where date is populated to it from Parse. I have a separate
CustomTableViewCell.swift
file which manages my cell layout.

The table displays lists of films, along with an poster image for that film. The image is declared as:

@IBOutlet weak var cellFilmImage: PFImageView!


in the
CustomTableViewCell.swift
file.

I have set constraints to the image in storyboard, for the image to be 95x140:

enter image description here

And I've also set the view mode to be Aspect fill:

enter image description here

I've added a border to my ImageView - which is light gray.

Issue: If I put a larger image there, it doesn't really respond to the settings that I've told it. See a screenshot below of what happens when I set the image to be larger:

enter image description here

You can see the gray outline of the ImageView, but why does the Image not sit inside the view?

Thanks in advance, let me know if you need to see any more of my code/settings.

Answer Source

Looks like you didn't set your imageView.clipsToBounds = true

Or set it from attributes inspector -> check Clip Subviews (Bottom of the image :] )

enter image description here

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download