Open
Description
移除动画时,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;(改成这行)
}
}];
});
}];
}
Metadata
Metadata
Assignees
Labels
No labels