I use CGRect to display an image. I would like CGRect to use the width and height of the image without specifying it.
maybe this:
CGRectMake(0.0f, 40.0f, 480.0f, 280.0f);
do the following:
CGRectMake(0.0f, 40.0f, myImage.width, myImage.height);
Some images get distorted when I specify the options.
here is the code:
CGRect myImageRect = CGRectMake(0.0f, 40.0f, 480.0f, 280.0f);
UIImageView *myImage = [[UIImageView alloc] initWithFrame:myImageRect];
[myImage setImage:[UIImage imageNamed:recipe.img]];
Thanks for any help.
source
share