Coder Social home page Coder Social logo

Comments (14)

ancloid avatar ancloid commented on July 21, 2024

Ok, i found solution. If somebody need it just ask! ;)

from klcpopup.

buddyhut avatar buddyhut commented on July 21, 2024

I am getting same issue after adding Google Mobile Ads 7.0

Please help me out how to solve this issue.

Regards
Alok

from klcpopup.

buddyhut avatar buddyhut commented on July 21, 2024

Hi,
@anclefeudor
Can you Please provide the solution for the same.

Regards
Alok

from klcpopup.

tuanphamanh91 avatar tuanphamanh91 commented on July 21, 2024

i have same issue :(
@anclefeudor , @alokfuterox please help.

Thanks advance.

from klcpopup.

ancloid avatar ancloid commented on July 21, 2024

I think Google used same upper view for default popup, so we need to define custom root layer for popup.
As a quick fix i just create a new method:

KLCPopup.h
- (void)showWithRoot:(UIView*)view;

KLCPopup.m

- (void)showWithRoot:(UIView*)view {
    NSDictionary* parameters = @{@"layout" : [NSValue valueWithKLCPopupLayout:KLCPopupLayoutCenter],
                                 @"duration" : @"0.0",
                                 @"root" : view};
    [self showWithParameters:parameters];
}

and replace

if(!self.superview){
        NSEnumerator *frontToBackWindows = [[[UIApplication sharedApplication] windows] reverseObjectEnumerator];

        for (UIWindow *window in frontToBackWindows) {
          if (window.windowLevel == UIWindowLevelNormal) {
            [window addSubview:self];

            break;
          }
        }
      }

with this

if(!self.superview){
          UIView* rootView = [parameters valueForKey:@"root"];
          if(rootView == nil){
              NSEnumerator *frontToBackWindows = [[[UIApplication sharedApplication] windows] reverseObjectEnumerator];

              for (UIWindow *window in frontToBackWindows) {
                  if (window.windowLevel == UIWindowLevelNormal) {
                      [window addSubview:self];
                      break;
                  }
              }
          }else{
              [rootView addSubview:self];
          }
      }

And of course you need to use this method for show popup.
Just create some empty view and use it as root for popup.

Actually it must be fixed - (void)showAtCenter:(CGPoint)center inView:(UIView*)view method, but i'm lazy, sorry...

from klcpopup.

tuanphamanh91 avatar tuanphamanh91 commented on July 21, 2024

@anclefeudor thanks for your reply, I've done it 🎉
Again, Thank you so much!

from klcpopup.

buddyhut avatar buddyhut commented on July 21, 2024

@anclefeudor

Thank a lot.
Regards
Alok

from klcpopup.

Daltron avatar Daltron commented on July 21, 2024

Awesome workaround. Thanks a bunch!

from klcpopup.

razor28 avatar razor28 commented on July 21, 2024

Thank you for fast fix!

from klcpopup.

xarlotie avatar xarlotie commented on July 21, 2024

It is still not working for me. I tried it on iOS 7.1 and it's working fine. But on iOS 8.1 and 8.4, nothing is showing up.

from klcpopup.

ancloid avatar ancloid commented on July 21, 2024

Sorry, in 8.4.1 my fix is work. Check your code twice!

from klcpopup.

xarlotie avatar xarlotie commented on July 21, 2024

I made it work by making self.view of the viewController as rootview.

from klcpopup.

sagarsurani avatar sagarsurani commented on July 21, 2024

Thank you @anclefeudor

from klcpopup.

khanh-bh avatar khanh-bh commented on July 21, 2024

How about this fix?

@@ -541,7 +541,7 @@ - (void)showWithParameters:(NSDictionary*)parameters {
                     NSEnumerator *frontToBackWindows = [[[UIApplication sharedApplication] windows] reverseObjectEnumerator];
                     
                     for (UIWindow *window in frontToBackWindows) {
-                        if (window.windowLevel == UIWindowLevelNormal) {
+                        if (window.windowLevel == UIWindowLevelNormal && !window.isHidden) {
                             [window addSubview:self];
                             
                             break;

from klcpopup.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.