简体   繁体   中英

How do I save the state of a UIImage or UIImageView?

So I've let the user transform a UIImage inside of my custom TransformView which is a subclassed UIImageView. It allows the user to rotate, scale, and pan using touchesEnded, touchesMoved, etc. Now what I'm trying to do, because my image is so large and takes up too much memory, is to remove it from view and set it to nil when the user switches tabs.

How do I save the state of the image so that it can load again from the same position? I want it to have the same zoom level, rotation, and position on screen. Any thoughts? Thanks so much!

It depends on how you did your transformations. If you were doing them using CATransform's them the image change won't affect them. But if you were drawing into context, then you probably want to save the context.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM