Unique identifier of an UIView object

送分小仙女□ 提交于 2021-02-10 04:11:55

问题


I am having a following problem.

  1. When a certain touch occures on a UIVIew, I want to store this UIView's unique identifier (like let's say objectID) so that when I reopen my app again I can check if in the visible UIViews there is the one UIView with the unique ID from the storage. I do not want to store the tag values as object ids because they may not be unique and they are manualy set up. I need to get a unique identifier that is automatically assign by the system. Any ideas hot to get it?

回答1:


They don't have a unique identifier that will be the same each time the app is run.

What does the UIView represent i.e. someone's name? Store that piece of information instead and re-create the view when the app next starts up.




回答2:


Old thread but, restorationIdentifier is probably what was wanted here.



来源:https://stackoverflow.com/questions/3966532/unique-identifier-of-an-uiview-object

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!