1 -(UIImage*)changeImage:(UIImage*)imageT withNewSize:(CGSize)newSizeT 2 { 3 //define a new image 4 UIImage* newImage = nil; 5 6 //set the image to current context 7 UIGraphicsBegainImageContext(newSizeT); 8 //redraw the image to new rect 9 [imageT drawRect:CGRectMake(0,0,newSizeT.width,newSizeT.height)]; 10 // 11 newImage = UIGraphicsGetImageFromCurrentContext(); 12 //end image context operator 13 UIGraphicsEndImageContext(); 14 15 // 16 return newImage; 17 }