| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116 |
- //
- // KKPopupViewWrapper.m
- // KKTV
- //
- // Created by yangyi on 2018/7/6.
- //
- #import "RAPopviewContainer.h"
- @protocol RAPopviewContainerProtocol <NSObject>
- @property (nonatomic, weak) RAPopviewContainer *container;
- @end
- @implementation RAPopviewContainer
- {
- id<RAPopviewProtocol> _popupView;
- }
- - (instancetype)initWithView:(id<RAPopviewProtocol>)popupView
- {
- if (self = [super init]) {
- _popupView = popupView;
- ((id<RAPopviewContainerProtocol>)_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 = [UIApplication sharedApplication].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();
-
- NSLog(@"hide...");
- [self removeFromSuperview];
- }
- - (void)onBkgButtonClicked:(id)sender
- {
-
- if(self.modalView)
- return;
- [_popupView hide];
- }
- @end
- @interface RAPopView () <RAPopviewContainerProtocol>
- @end
- @implementation RAPopView
- @synthesize container;
- - (UIView*)show:(UIView *)parentView
- {
- [parentView addSubview:self];
- return self;
- }
- - (void)hide
- {
- [self removeFromSuperview];
-
- [self.container hide];
- }
- @end
- ////
- ////@interface KKPopupObject () <KKPopupViewWrapperProtocol>
- ////
- ////@end
- ////
- ////@implementation KKPopupObject
- ////
- ////@synthesize wrapper;
- ////
- ////- (UIView *)show:(UIView *)parentView
- ////{
- //// return nil;
- ////}
- ////
- ////- (void)hide
- ////{
- //// [self.wrapper hide];
- ////}
- //
- //@end
|