If I have a Class (MyClass) with an attribute myAttribute, I can t use it in a subclass (MySubclass) without calling self.myAttribute. I have not problem with this sort of code when running the app with the simulator. You might be wondering: "why does she do this?". It s quite easy to add "self" everywhere. The problem is that in MySubclass I m overriding some accessor methods of MyClass. Here s an example:
- (NSDateFormatter *)dateFormatter
{
if (dateFormatter == nil)
{
dateFormatter = [[NSDateFormatter alloc] init];
// Do other stuff with the dateFormatter
}
return dateFormatter;
}
我可以说自己。 日期 炉内的形式,因为它会造成无休止的 lo。 我可以支持我处理该问题的班子,但处理此类问题可能是一个良好和简单的解决办法。
感谢!