【问题标题】:iOS - UILabel(CALayer) - VMalloc memory keep increasingiOS - UILabel(CALayer) - VMalloc 内存不断增加
【发布时间】:2015-05-14 02:39:52
【问题描述】:

我使用 Instrument 来测试我的应用程序,其中 2 个 ViewControllers 通过 segue 使用按钮来回移动。我注意到我在ViewController1(使用Interface Builder 创建)中的所有UILabel 每次访问ViewController1 时都会不断增加我的内存分配。我可以设置设置中的某个地方,以便它会释放或至少不会增长?

【问题讨论】:

    标签: ios objective-c ipad interface-builder


    【解决方案1】:

    尝试在 dealloc 方法中将所有 UILabel 设置为 nil。

    - (void)dealloc
    {
        self.mYLabel = nil;
    
        [super dealloc];
    }
    

    【讨论】:

    • 我用的是ARC,所以我没有dealloc
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-10-20
    • 2016-02-24
    • 1970-01-01
    • 2014-11-13
    • 2014-06-14
    相关资源
    最近更新 更多