Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个显示一本书细节的视图控制器。我想要做的是在从导航控制器弹出视图控制器之前将数据保存到后台线程中的数据库。
我不知道将逻辑保存数据放在哪里,viewWillDisappear或者deinit是正确的选择?
viewWillDisappear
deinit
我认为您只需要创建一个全局服务即可调用您想要保存的任何内容。然后用你的数据调用它viewDidDisappeared()
viewDidDisappeared()