static Person *person

//单例初始化方法

+ (instancetype)allocWithZone:(struck _NSZone*)zone{

  if (person == nil){

    static dispatch_once_t onceToken;

        dispatch_once(&onceToken, ^{

            person = [super allocWithZone:zone];

        });

  }

  return person;

}

+ (instancetype)sharePerson{

  return [[self alloc]init];

}

- (id)copy{

  return self;

}

 

posted on 2016-03-10 19:07  优雅的疯子≈  阅读(187)  评论(0编辑  收藏  举报