一行代码集成微信浮窗功能
在需要浮窗展示的地方调用:
// self 为需要浮窗展示的控制器
[XWFloatingWindowView showWithViewController:self];
现在你的控制器就已经集成微信浮窗功能了😀
// self 为当前控制器
BOOL isShowing = [XWFloatingWindowView isShowingWithViewController:self]
他会告诉你当前控制器是否已集成在浮窗内。
// 移除浮窗,释放控制器
[XWFloatingWindowView remove];
#pragma mark - 单例对象
static XXClassManager *_defaultManager;
+ (instancetype)shareInstance {
if (!_defaultManager) {
_defaultManager = [[self alloc] init];
}
return _defaultManager;
}
+ (instancetype)allocWithZone:(struct _NSZone *)zone {
if (!_defaultManager) {
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
_defaultManager = [super allocWithZone:zone];
});
}
return _defaultManager;
}
- (id)copyWithZone:(NSZone *)zone{
return _defaultManager;
}
- (id)mutableCopyWithZone:(NSZone *)zone{
return _defaultManager;
}
详情实现可下载源码查看: XWFloatingWindow
- ✍️ 笔者博客:极客学伟的技术分享社区