Singleton object are created only once in the life cycle of the app.
Singleton object can be accessed using [ClassName sharedInstance].
+(id)sharedInstance{
static MyClassManager *sharedMyClassManager = nil;
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
sharedMyClassManager = [[self alloc] init];
});
retrun sharedMyClassManager;
}
Singleton object can be accessed using [ClassName sharedInstance].
+(id)sharedInstance{
static MyClassManager *sharedMyClassManager = nil;
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
sharedMyClassManager = [[self alloc] init];
});
retrun sharedMyClassManager;
}
WebRep
currentVote
noRating
noWeight
No comments:
Post a Comment