I am resizing a image to fit it in a bar. I need to resize it because the image is in a db and this is use for the same app in android too. the thing is this code is working well in iOS 6.1 but in lower 5.0 5.1 I am having a black image in the bar. The code is the following:
CGSize newSize=CGSizeMake(320,44);
UIGraphicsBeginImageContext(newSize);
[image drawInRect:CGRectMake(0,0,newSize.width,newSize.height)];
UIImage* newImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
[self.navigationController.navigationBar setBackgroundImage:newImage forBarMetrics:UIBarMetricsDefault];
some ideas of this wrong behavior?


Thanks
Use following method for specific hight and width with image
This method return NewImage, with specific size that you specify 🙂
This code may be helpful for you:)