私が勉強を続けるにつれて、本はシングルトンを実装しました。それを使用する理由は理解しましたが、コードに関する明確化が必要でした。
+ (BNRItemStore *)defaultStore
{
static BNRItemStore *defaultStore = nil;
if(!defaultStore)
defaultStore = [[super allocWithZone:nil] init];
return defaultStore;
}
static BNRItemStore * defaultStore = nil;
returnステートメントまでの行で。私の質問は; このクラスを呼び出すたびに[[BNRItemStore defaultStore] someMethod];
、別のクラスまたはアプリの一部で、defaultStore 変数が nil に設定されますか?
乾杯