How to implement didReceiveMemoryWarning in Swift?

前端 未结 2 1471
清酒与你
清酒与你 2021-02-01 15:12

Whenever I create a new View Controller subclass, Xcode automatically adds the method

override func didReceiveMemoryWarning() {
    super.didReceiveMemoryWarning         


        
2条回答
  •  执笔经年
    2021-02-01 16:02

    When didReceiveMemoryWarning is called, it means your app is using too much memory (compare with memory of device), and you should release any additional memory used by your view controller to reduce the memory of your app. If the memory app gets over the memory of device, iOS will kill your app immediately. "resources that can be recreated" means somethings you can recreate it again at somewhere, you don't need them now (don't need to put them in the memory). And you can release it when get didReceiveMemoryWarning.

    Here is another detail topic: ios app maximum memory budget

提交回复
热议问题