You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi there,
just wanted to report a small bug in your sample project.
Having images that fulfill ( (imageSize.width <= bounds.size.width) && (imageSize.height <= bounds.size.height) ) will result in an _imageView of size CGRectZero since you return without setting it´s bounds to that of the image.
The line _imageView.frame = frame; is missing.
Thanks for great work!
- (void) layoutSubviews
{
[superlayoutSubviews];
CGSizeimageSize=_imageView.image.size;
CGRectframe=_imageView.frame;
CGRectbounds=self.contentView.bounds;
if ( (imageSize.width <= bounds.size.width) &&
(imageSize.height <= bounds.size.height) )
{
//This line was missing_imageView.frame=frame;
return;
}
// scale it down to fitCGFloathRatio=bounds.size.width / imageSize.width;
CGFloatvRatio=bounds.size.height / imageSize.height;
CGFloatratio=MAX(hRatio, vRatio);
frame.size.width=floorf(imageSize.width*ratio);
frame.size.height=floorf(imageSize.height*ratio);
frame.origin.x=floorf((bounds.size.width-frame.size.width) *0.5);
frame.origin.y=floorf((bounds.size.height-frame.size.height) *0.5);
_imageView.frame=frame;
}
The text was updated successfully, but these errors were encountered:
Hi there,
just wanted to report a small bug in your sample project.
Having images that fulfill ( (imageSize.width <= bounds.size.width) && (imageSize.height <= bounds.size.height) ) will result in an _imageView of size CGRectZero since you return without setting it´s bounds to that of the image.
The line _imageView.frame = frame; is missing.
Thanks for great work!
The text was updated successfully, but these errors were encountered: