tags:

views:

19

answers:

1

Ive an image with particular resolution appearing on Iphone screen. I need to resize that image by getting info. as an alert from user(Width and height). Cud anyone help me with block of code for this????

A: 

WARNING: code typed in answer box, not tested. It's pretty close, though.

NSSize newSize = [self getSizeFromUser];  // you have to write this part.
CGRect theRect = CGRectMake (0, 0, newSize.width, newSize.height);

// Put image into new context
UIGraphicsBeginImageContext (newSize);
    [theImage drawInRect: theRect];
    //get the image from the context
    UIImage *newImage = UIGraphicsGetImageFromCurrentImageContext();
    [[compositeImage retain] autorelease];
UIGraphicsEndImageContext();
Olie