单粒的写法

#import "CDCommentAlertView.h"

@interface CDCommentAlertView ()

@end

static CDCommentAlertView *currentView = nil;

@implementation CDCommentAlertView

+ (CDCommentAlertView *)currentView; {

    @synchronized(self) {

        if (currentView == nil) {

            currentView = [[self alloc] init];

        }

    }

    return currentView;

}

原文地址:https://www.cnblogs.com/gaoxiaoniu/p/5626063.html