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

Fixed crash caused by continuous calls to "setCustomView:" method #627

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

liLeiBest
Copy link

UIImage *img = [UIImage imageNamed:@"hub_warning_icon"];
UIImageView *customView = [[UIImageView alloc] initWithImage:img];
for (NSUInteger i = 0; i < 2; i++) {
    
    MBProgressHUD *hud = [self toastToView:self.view];
    hud.mode = MBProgressHUDModeCustomView;
    [hud setCustomView:customView];
    hud.label.text = @"Title";
    hud.detailsLabel.text = @"Content";
    [hud hideAnimated:YES afterDelay:2];
}

The above code will crash, and the log is as follows:

Thread 1: "Unable to install constraint on view. Does the constraint reference something from outside the subtree of the view? That's illegal. constraint:<NSLayoutConstraint:0x600003178870 UIImageView:0x151007950.centerX == MBBackgroundView:0x14fe48390.centerX (active)> view:<MBBackgroundView: 0x14fe48390; frame = (0 0; 0 0); clipsToBounds = YES; animations = { opacity=<CASpringAnimation: 0x600001258160>; }; layer = <CALayer: 0x600001260c60>>"

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

Successfully merging this pull request may close these issues.

1 participant