在我的项目中,我使用 Facebook API“three20”:https ://github.com/facebook/three20/
现在,我需要自定义 TTPhotoViewController。在画廊中,有一个“自动缩放”。始终使用完整的宽度和高度:
缺点是您看不到完整的照片,重要信息可能会被剪切/裁剪。
如何禁用自动缩放?
谢谢!
编辑 2011 年 3 月 3 日:
罗曼的回答似乎很好,但不幸的是它对我没有帮助。是的,内容模式UIViewContentModeScaleAspectFill
是问题所在:
缩放内容以填充视图的大小。内容的某些部分可能会被剪裁以填充视图的边界。
但是没有其他内容模式可以解决我的问题。我想,我必须深入到three20内部并自己缩放图像。但我需要你的帮助才能做到这一点!所以,我今天(03/03/2011)开始新的“赏金”...
非常感谢你!!
编辑 2011 年 3 月 7 日:
终于我明白了!!罗马的答案是对的,我必须使用UIViewContentModeScaleAspectFit
.
问题是:我在Photo
-Object 中使用了错误的大小!320x480 为我工作:
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];