开发者

Remove data from UIViewController when removing it from the Navigation Stack

开发者 https://www.devze.com 2023-02-10 06:37 出处:网络
I\'ve built an order process application which has about 5-6 Views that capture data and save it to a database.

I've built an order process application which has about 5-6 Views that capture data and save it to a database.

Now 开发者_开发技巧once the order is complete, I'm using PopToRootViewController to return to the first View but I'd like the data on the other Views to disappear (basically start a new order).

At the moment if I open the view again the data from the previous 'order' is still there...

So how do I dispose of all the UIViewControllers once an order is complete?


It depends entirely on how you're managing your view controllers. It sounds like you should be releasing them after each order, and creating new ones for the next order. Instead, it sounds like you're keeping them around in your app or root level controller.


If your certain they're being released (which you could check the retain counts to see if it crashes), then maybe on each view controllers viewWillAppear method you could re-init the data. But that's more of a work around than understanding what's wrong.

0

精彩评论

暂无评论...
验证码 换一张
取 消