jmascia / KLCPopup

A simple and flexible class for presenting custom views as a popup in iOS.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Popup doesn't show at all

xarlotie opened this issue · comments

Even the basic example doesn't work. No error. No popup. Just nothing.

It works. Can you post you're code.

I just used your sample code and inserted it in my codes.

- (void) switchChanged:(id)sender {
    UISwitch * switchControl = sender;
    NSLog( @"SWITCH The switch is %@", switchControl.on ? @"ON" : @"OFF" );

    if(switchControl.on) {
        NSLog(@"SWITCH Show it!");
        [self.popup show];
    }
}

- (KLCPopup *) popup{
    if (_popup == nil){
        UIView* contentView = [[UIView alloc] init];
        contentView.translatesAutoresizingMaskIntoConstraints = NO;
        contentView.backgroundColor = [UIColor whiteColor];
        contentView.layer.cornerRadius = 12.0;

        UILabel* dismissLabel = [[UILabel alloc] init];
        dismissLabel.translatesAutoresizingMaskIntoConstraints = NO;
        dismissLabel.backgroundColor = [UIColor clearColor];
        dismissLabel.textColor = [UIColor whiteColor];
        dismissLabel.font = [UIFont boldSystemFontOfSize:72.0];
        dismissLabel.text = @"Hi.";

        [contentView addSubview:dismissLabel];

        _popup = [KLCPopup popupWithContentView:contentView];
    }

    return _popup;
}

Try doing it this way,

KLCPopup* popup = [KLCPopup popupWithContentView:contentView];
popup.dimmedMaskAlpha = .85;
[popup show];

I already copied the whole ViewController code in your example and calls that controller within my app but the popup still does not appear. I also tried other popup libraries but they all don't show up. What could be the problem?

I found the real culprit. I tried it on iOS 7.1 and it worked. It is not working on iOS 8 (as tested on iOS 8.1 and 8.4).

What do you think is the problem here? Thanks!

I tried to run the sample project included in this repo on an ios 8.4 simulator and it worked. But i still can't figure out why it doesn't work when included within my application. Any help will be so much appreciated. Thanks!

in KLCPopup.m
replace line 538 from
if (window.windowLevel == UIWindowLevelNormal) {

to

if (window.windowLevel == UIWindowLevelNormal && window.hidden == NO) {

may be help

@chatdanai Thanks a lot.
It should be updated like that.

@chatdanai Thanks !!! Suddenly KLC didn't showed up anymore, whereas it has been working for months very well. The only thing I've done is adding Firebase and Google frameworks, weird... If someone has an explanation for this 👍
Your solution worked for me !!!

@chatdanai your solution worked! I'm just curious, the pod has been working fine for months and suddenly stop working. Do you have an explanation for this?

@amtung I haven't dug into the detail. I thought when ios updated, window, view structure may be change.