Created
October 7, 2013 14:10
-
-
Save yaoxinghuo/6868637 to your computer and use it in GitHub Desktop.
OC 创建单例
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// 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