在Apple的BubbleLevel示例的AppDelegate中,他们执行以下操作:
+ (void)initialize {
if ([self class] == [LevelAppDelegate class]) {
// Register a default value for the instrument calibration.
// This will be used if the user hasn't calibrated the instrument.
NSNumber *defaultCalibrationOffset = [NSNumber numberWithFloat:0.0];
NSDictionary *resourceDict = [NSDictionary dictionaryWithObject:defaultCalibrationOffset forKey:BubbleLevelCalibrationOffsetKey];
[[NSUserDefaults standardUserDefaults] registerDefaults:resourceDict];
}
}
为什么他们这样做[自我类] == [LevelAppDelegate类]?
答案 0 :(得分:3)