Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

有个bug #6

Closed
392222523 opened this issue Apr 27, 2017 · 6 comments
Closed

有个bug #6

392222523 opened this issue Apr 27, 2017 · 6 comments

Comments

@392222523
Copy link

连续弹出2个view就消失不了

@snail-z
Copy link
Owner

snail-z commented Apr 27, 2017

怎么会连续弹出两个view?能说下具体情况吗 或是你的使用场景是什么样的?

@392222523
Copy link
Author

在网络请求失败的时候弹窗,然后一个页面有2个请求,没网络状态会弹2个

@392222523
Copy link
Author

SnailAlertView *alert = [[SnailAlertView alloc] initWithTitle:title message:message fixedWidth:300];
alert.linesHidden = YES;

SnailAlertButton *can = [SnailAlertButton cancelButtonWithTitle:cancelTitle handler:cancel];

can.edgeInset = UIEdgeInsetsMake(20, 20, 20, 20);
can.backgroundColor = [UIColor whiteColor];
[can.layer setBorderColor:[[UIColor blackColor] CGColor]];

can.layer.borderWidth = 0.5;
[can.layer masksToBounds];

[can setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];

[alert addAction:can];


AppDelegate *ad = (AppDelegate*)[UIApplication sharedApplication].delegate;
ad.window.sl_popupController = [SnailPopupController new];

ad.window.sl_popupController.maskType = PopupMaskTypeBlackBlur;
ad.window.sl_popupController.transitStyle = PopupTransitStyleShrinkInOut;
[ad.window.sl_popupController presentContentView:alert duration:0.5 elasticAnimated:YES];

@392222523
Copy link
Author

ad.window.sl_popupController = [SnailPopupController sl_popupController];
用这个初始化,会有个蒙版消失不了.检查视图发现还是2个view.dismiss不掉.

@392222523
Copy link
Author

  • (void)buttonClicked:(UIButton *)sender {
    NSString *selName = [NSString stringWithFormat:@"example%lu", sender.tag + 1];
    SEL sel = NSSelectorFromString(selName);
    if ([self respondsToSelector:sel]) {
    self.title = _styles[sender.tag];
    [self performSelector:sel withObject:nil afterDelay:0];
    [self performSelector:sel withObject:nil afterDelay:0]; // 在demo中连续调用2次就会出现.

    }
    }

@snail-z
Copy link
Owner

snail-z commented Apr 29, 2017

确实有这个问题,我已经做了修改。
不过叠加弹出窗口应该是不合理的,另外这样操作相当于创建了两个不同的对象赋给了self.sl_popupController ,所以前一个已经delloc了 ,但是视图没有消失(这是个bug)。如果非要同时叠加多个,应该创建多个不同的全局变量来保存每个对象。

@snail-z snail-z closed this as completed Aug 25, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants