Do I need use dealloc method with ARC?

后端 未结 5 1708
别跟我提以往
别跟我提以往 2021-02-01 14:03

So, I have class:

@interface Controller : NSObject
{
    UILabel* fileDescription;
}

@property(strong, nonatomic) UILabel* fileDescription;

D

5条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2021-02-01 14:57

    Generally you don't need to provide a subclassed dealloc method as ARC manages the lifetime of the instance variables.

    However it can be useful to perform clean-up other than releasing objects, for example to remove an observer or close a network connection down cleanly. You are therefore allowed to subclass dealloc under ARC, but you are not allowed to call [super dealloc] from within the subclassed method.

    In your particular case it's not required, however.

提交回复
热议问题