Friday, February 24, 2012

Dynamically use UIViewContentModeScaleAspectFit and UIViewContentModeScaleAspectFill


I am trying to display images on the iPhone in the same way that the Photo app does. It seems to be able to dynamically select UIViewContentModeScaleAspectFit or UIViewContentModeScaleAspectFill depending on what is appropriate for the image. Where possible I would like images to appear full screen but if not then I would like them to appear UIViewContentModeScaleAspectFit


1 comment:

  1. When you have an image check the size of the image, and then have a test or something.

    if (imageSize > screenSize){
    imageView.contentMode = UIViewContentModeScaleAspect..
    }else{
    imageView.contentMode = UIViewContentModeScaleAspect...
    }


    Hope this helps!
    Tams

    ReplyDelete