static MainVideoViewController *_instance = nil;
static dispatch_once_t onceToken0;
static dispatch_once_t onceToken1;
@implementation MainVideoViewController
+ (instancetype)defaultMainVideoVC{
if (_instance == nil) {
dispatch_once(&onceToken0, ^{
_instance = [[MainVideoViewController alloc] init];
});
}
return _instance;
}
/** 注意苹果不建议重写此方法但是不重写此方法就不能是一个真实的单例 */
+ (instancetype)allocWithZone:(struct _NSZone *)zone{
if (_instance == nil) {
dispatch_once(&onceToken1, ^{
_instance = [super allocWithZone:zone];
});
}
return _instance;
}
+ (void)destoryShareRootVC{
onceToken0 = 0;
onceToken1 = 0;
_instance = nil;
}
#pragma mark - 生命周期
- (void)dealloc{
JFLog(DBGMatchTalk, @"MainVC dealloc");
}