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

如果BHBItem添加过多(9个)的话,移除动画的时候会出现事件无法传递,报unexpected nil window in __dispatchPreprocessedEventFromEventQueue的问题 #12

Open
SenorSamuel opened this issue Sep 27, 2016 · 1 comment

Comments

@SenorSamuel
Copy link

移除动画时,BHBItem过多,completed的时候self.superview.superview== nil
以下是我的解决方法,请勿见笑


- (void)removeAnimation{
    [self.visableBtnArray enumerateObjectsWithOptions:NSEnumerationReverse usingBlock:^(id obj, NSUInteger idx, BOOL *stop) {
        BHBCustomBtn * btn = obj;
        CGFloat x = btn.frame.origin.x;
        CGFloat y = btn.frame.origin.y;
        CGFloat width = btn.frame.size.width;
        CGFloat height = btn.frame.size.height;
        UIView *containerView = self.superview.superview;
        dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)((self.visableBtnArray.count - idx) * 0.03 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
            [UIView animateWithDuration:.5 delay:0 usingSpringWithDamping:0.9 initialSpringVelocity:5 options:0 animations:^{
                btn.alpha = 0;
                btn.frame = CGRectMake(x, [UIScreen mainScreen].bounds.size.height - self.frame.origin.y + y, width, height);
            } completion:^(BOOL finished) {
                if ([btn isEqual:[self.visableBtnArray firstObject]]) {
//                    self.superview.superview.userInteractionEnabled = YES;
                    containerView.userInteractionEnabled = YES;(改成这行)
                }
            }];
        });

    }];

}

@bb-coder
Copy link
Owner

赞👍,你提个mr我和进去~

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