我使用下面的動畫顯示的縮略圖的全屏圖像到視圖:目標C - 設置ImageView的寬度和保持長寬比
[UIView animateWithDuration:0.5 delay:0 options:0 animations:^{
[testImageView setFrame:CGRectMake(0, 0, testImage.size.width, testImage.size.height)];
}completion:^(BOOL finished){
}];
然而,這將不包含在範圍內的圖像如果是大圖像,則顯示屏幕。
有沒有一種方法可以將圖像的寬度設置爲屏幕寬度,然後調整圖像的高度,然後保持適當的寬高比?