I have recently set-up an in-app purchase mechanism in my app. During the purchase i would like to update an hud (i am using the mbprogresshud) according to two kinds of events: i start a purchase and i receive a validation of the purchase. The problem i am facing is that the hud is never updated with the one i want when the purchase is done (custom view):
- When i click on the purchase button:
-(IBAction)buyButtonTapped:(id)sender { self.hud = [[SCLProgressHUD alloc] initWithView:self.view]; [self.view addSubview:self.hud]; self.hud.labelText = @"Connecting..."; self.hud.minSize = CGSizeMake(100 , 100); [self.hud show:YES]; ... }
- When i receive a notification that the purchase was successful:
-(void)productPurchased:(NSNotification *)notification { self.hud.customView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"checkmark_icon.png"]]; self.hud.mode = SCLProgressHUDModeCustomView; self.hud.labelText = @"Thanks for your purchase!"; ... }
Setting the self.hud.customView property in the last method will trigger a [self setNeedsLayout]; and [self setNeedsDisplay] within the hud class but still i don't observe any change.
Any possible idea of what i am doing wrong here?