Forum Xamarin.iOS

ImageView Image in a CollectionView not filling entire content of the cell.

Danny.BDanny.B USMember
edited October 2016 in Xamarin.iOS


Just started working with Xamarin IOS and having a little trouble with the display of images in a UICollectionViewCell. Here is my code for the cell:


        public HouseCell (CGRect frame) : base(frame)
        ContentView.Layer.BorderWidth = 0f;
        ContentView.BackgroundColor = UIColor.FromRGB(235, 30, 82);

        houseImageView = new UIImageView(UIImage.FromBundle("house-1-thumb.png"));
        houseImageView.ContentMode = UIViewContentMode.ScaleAspectFill;
        houseImageView.ClipsToBounds = true;


    public UIImage Image
            houseImageView.Image = value;

Here is the result I am seeing from that code:


I am not sure if this is the correct approach tbh and if the image view frame should be set with values rather than trying to scale? Have tried a few things as trial and error with no luck. Any assistance or advice appreciated.


Best Answer


  • Danny.BDanny.B USMember

    Thanks Jason for your explanation, so with that providing a size now it is filling the space as planned. Code was:

    ContentView.Transform = CGAffineTransform.MakeScale(1f, 1f);

Sign In or Register to comment.