Regarding Erica Sadun's iPhone Developer Cookbook, in Chapter 8, Exercise 14 Resize and Rotate: the example works just fine, I am able to rotate, resize and whatev开发者_开发百科er. The issue is, how do you reference the altered image after it has been scaled, rotate? When attempting to save the photo, it is saved as the original photo and not the edited one.
I assume you are resizing and rotating a UIImageView
that is visible on the device's screen. If this is the case, then your manipulations are being applied as matrix transformations on the UIView
when it renders, and are not actually modifying the backing image at all. So if you want to save a snapshot of the image's current state, then you need to draw your view into an appropriately-sized CGContext
, and then create a new image from that context.
You may find these resources helpful:
How to render UIView into a CGContext
http://vocaro.com/trevor/blog/2009/10/12/resize-a-uiimage-the-right-way/
精彩评论