// // KKPopupViewWrapper.m // KKTV // // Created by yangyi on 2018/7/6. // #import "RAPopviewContainer.h" #import "const.h" #import "RAUtils.h" @protocol RAPopviewContainerProtocol @property (nonatomic, weak) RAPopviewContainer *container; @end @implementation RAPopviewContainer { id _popupView; } - (instancetype)initWithView:(id)popupView { if (self = [super init]) { _popupView = popupView; ((id)_popupView).container = self; } return self; } - (UIView *)show:(UIView*)parentView { // [parentView setClipsToBounds:false]; UIView *view = [_popupView show:parentView]; if (self.bgColor) self.backgroundColor = self.bgColor; // return [PopWaitAlert Show: title:title message:@"Please wait..." completion:nil]; // ; // CGRect r1 =[UIApplication sharedApplication].keyWindow.bounds; // CGRect r2 =[UIApplication sharedApplication].keyWindow.rootViewController.view.bounds; self.frame = [RAUtils keyWindow].bounds;//parentView.bounds; [self addTarget:self action:@selector(onBkgButtonClicked:) forControlEvents:UIControlEventTouchUpInside]; // [[UIApplication sharedApplication].keyWindow // [[UIApplication sharedApplication].keyWindow addSubview:view]; [parentView insertSubview:self belowSubview:view]; return nil; } - (void)hide { if (self.hideHandler) self.hideHandler(); DebugLog(@"hide..."); [self removeFromSuperview]; } - (void)onBkgButtonClicked:(id)sender { if(self.modalView) return; [_popupView hide]; } @end @interface RAPopView () @end @implementation RAPopView @synthesize container; - (UIView*)show:(UIView *)parentView { [parentView addSubview:self]; return self; } - (void)hide { [self removeFromSuperview]; [self.container hide]; } @end //// ////@interface KKPopupObject () //// ////@end //// ////@implementation KKPopupObject //// ////@synthesize wrapper; //// ////- (UIView *)show:(UIView *)parentView ////{ //// return nil; ////} //// ////- (void)hide ////{ //// [self.wrapper hide]; ////} // //@end