Skip to main content

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




Comments

  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

Post a Comment

Popular posts from this blog

Slow Android emulator

I have a 2.67 GHz Celeron processor, 1.21 GB of RAM on a x86 Windows XP Professional machine. My understanding is that the Android emulator should start fairly quickly on such a machine, but for me it does not. I have followed all instructions in setting up the IDE, SDKs, JDKs and such and have had some success in staring the emulator quickly but is very particulary. How can I, if possible, fix this problem?