OC单例

  • (instancetype)sharedManager
    {
    static dispatch_once_t onceToken;
    dispatch_once(&onceToken, ^{
    _sharedManger = [[super allocWithZone:NULL] init];
    });
    return _sharedManger;
    }
  • (id)copyWithZone:(NSZone *)zone
    {
    return [xxxx sharedManager];
    }
  • (id)allocWithZone:(struct _NSZone *)zone
    {
    return [xxxx sharedManager];
    }

你可能感兴趣的:(OC单例)