Skip to content

Instantly share code, notes, and snippets.

@yaoxinghuo
Created October 7, 2013 14:10
Show Gist options
  • Save yaoxinghuo/6868637 to your computer and use it in GitHub Desktop.
Save yaoxinghuo/6868637 to your computer and use it in GitHub Desktop.
OC 创建单例
//
// UserConext.m
// HelloWorld
//
// Created by Terry on 2013-10-07.
// Copyright (c) 2013 Terry. All rights reserved.
//
#import "UserConext.h"
@implementation UserConext
static UserConext *singleton = nil;
+(id)sharedUserContext {
@synchronized(self){
if (!singleton) {
singleton = [[UserConext alloc] init];
}
}
return self;
}
@end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment