Saving UIView for next run (not as image)

I am creating an application with several UIViewsthat are dynamically generated based on user inputs. These UIViewsmay contain tags, images, and text. They take some time to create, so I would like the user to be able to quickly load them in future launches of the application without having to redo them again. One of the requirements is that they must maintain their interactive state so that the user can continue to edit them.

I looked NSKeyedArchiver, but it does not seem to support this UIImage. In addition, I cannot save it as PNG, since I would like to save their interactive state.

Is there any way to do this?

+3
source share
1 answer

You should consider storing your data model separately from the interface. You can then use this saved model to create an interface. I know that you specifically said that you do not want to do this. However, any built-in method will need to rebuild the UIView in exactly the same way.

If processing model data is a problem, try to come up with a way to effectively represent the state of the interface so that you don't have to start from scratch. However, it will be a lot more work.

0
source

Source: https://habr.com/ru/post/1791391/


All Articles