Friday, March 13, 2009

Quick tip: how to resize image?

Load image data:

UIImage *image = [[UIImage alloc] imageNamed: @"image.jpg"];

Create respective view:

UIImageView *imageView = [[ UIImageView alloc ] initWithImage: image];

Make frame, where you want to show image:

imageView.frame = CGRectMake(0.0, 0.0, 200.0, 200.0);

Finally, draw image:

[self.view addSubview: imageView];


P.S. Parameters of CGRectMake:
CGRectMake( [x point], [y point], [width], [height] )

No comments: