I am trying to change image size according to my view so I wrote this code for that.
-(UIImage *)imageWithImage:(UIImage*)image scaledToSize:(CGSize)newSize {
You should use NO as the second argument, that toggles the transparency of the image.
NO
UIGraphicsBeginImageContextWithOptions(newSize, NO, [UIScreen mainScreen].scale);
Check out Apple's documentation for more details.