KLCPopup icon indicating copy to clipboard operation
KLCPopup copied to clipboard

Popup doesn't show at all

Open xarlotie opened this issue 9 years ago • 11 comments

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

xarlotie avatar Aug 20 '15 06:08 xarlotie

It works. Can you post you're code.

TolgaB avatar Aug 22 '15 22:08 TolgaB

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;
}

xarlotie avatar Aug 24 '15 06:08 xarlotie

Try doing it this way,

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

TolgaB avatar Aug 24 '15 15:08 TolgaB

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?

xarlotie avatar Aug 24 '15 19:08 xarlotie

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!

xarlotie avatar Aug 25 '15 07:08 xarlotie

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!

xarlotie avatar Aug 26 '15 08:08 xarlotie

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

to

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

may be help

chatdanai avatar Sep 07 '15 06:09 chatdanai

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

umutafacan avatar Sep 27 '15 19:09 umutafacan

@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 !!!

AnthoPakPak avatar Nov 23 '16 22:11 AnthoPakPak

@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 avatar Aug 11 '17 18:08 amtung

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

chatdanai avatar Aug 12 '17 13:08 chatdanai