iphoneobjective-ciosthree20ttphotoviewcontroller

TTPhotoViewController: deactivate gallery auto zoom


In my project, I use the Facebook API "three20": https://github.com/facebook/three20/

Now, I need to customize the TTPhotoViewController. In the gallery, there's an "auto zoom". The complete width and height are always used: enter image description here

The disadvantage is that you can not see the complete photo and important information could be cut off / cropped.

How can I deactivate the automatic zoom?

Thanks!


EDIT 03-Mar-2011:

Roman's answer seems to be good, but unfortunately it doesn't helps me. Yes, the content mode UIViewContentModeScaleAspectFill is the problem:

Scales the content to fill the size of the view. Some portion of the content may be clipped to fill the view’s bounds.

But there's no other content mode that solves my problem. I think, I have to look deep inside three20 and scale the images by myself. But I need your help to do this! So, I'll start a new "bounty" today (03/03/2011)...

Thank you very much!!


EDIT 07-Mar-2011:

Finally I got it!! roman's answer is right, I have to use UIViewContentModeScaleAspectFit.

The problem was: I use a wrong size in my Photo-Object! 320x480 worked for me:

NSMutableArray *photos = [NSMutableArray new];

for (Information *info in allImages) {
    NSString *binaryId = info.binary;

    NSString *fileName = [NSString stringWithFormat:@"documents://img/%@.jpg", binaryId];

    Photo *photo = [[[Photo alloc] initWithCaption:info.name 
                                              urlLarge:fileName 
                                              urlSmall:fileName 
                                              urlThumb:fileName 
                                              size:CGSizeMake(320, 480)] autorelease];

    [photos addObject:photo];

}

self.photoSource = [[PhotoSet alloc] initWithTitle:@"Photos" photos:photos];

Solution

  • easiest way is to hack TTPhotoView - around line 135 (function setImage) change

    self.contentMode = UIViewContentModeScaleAspectFill;
    

    to

    self.contentMode = UIViewContentModeScaleAspectFit;
    

    sadly there does not seem to be another way currently.