views:

43

answers:

1

Hi, i load a transparent .png into an UIImage.

How to i calculte the real bounding-box. E.g. if the the real image is smaller than the .png-dimensions.

Thanks for helping

A: 
CGRect myImageViewRect = [myImageView frame];
CGSize myImageSize = [[myImageView image]size];

if(myImageSize.width < myImageViewRect.size.width){
   NSLog(@"it's width smaller!");
}
if(myImageSize.height < myImageViewRect.size.height){
   NSLog(@"it's height smaller!");
}

If you want the image to resize to the size of the image view you can call

[myImageView sizeToFit];
christo16