對於非指針變量,我必須在類的dealloc
方法中調用release
嗎?必須在dealloc中釋放非指針實例變量嗎?
例如
@interface myClass : NSObject {
BOOL isDirty; // do i have to release this?
NSInteger hoursSinceStart; // and this?
NSDate *myDate; // i will release the pointer in dealloc
}
@property (assign, nonatomic) NSInteger hoursSinceStart; // property to release?
@property (assign, nonatomic) BOOL isDirty; // property to release?
@end
不,這些值將保留在堆棧中,並在程序調用dealloc方法時彈出。 – fatih 2011-06-15 19:52:11
@faith我懷疑dealloc與堆棧變量有什麼關係? – Tatvamasi 2011-06-15 20:04:07