Why ARC is not deallocating memory after popViewController

前端 未结 9 775
刺人心
刺人心 2021-02-01 02:20

I\'m pushing and popping ViewControllers in UINavigationController.

I\'m tracking the memory consumption of my app. While pushing the new viewController the memory consu

9条回答
  •  深忆病人
    2021-02-01 02:27

    If your app design allows the user to push and pop the same view controller over and over again, you may want to look at reusing the same view controller and just updating its contents each time it's pushed.

    Instead of creating and destroying it over and over, create one, set up its contents and push, when it's popped, keep it around ready to be shown again. Next time it needs to be shown, update its contents and then push it again.

提交回复
热议问题