I am stuck in hidden problem. I want to remove all UIProgressView from Superview. I am creating cross button in this way,
crossButton = [[CCMenuItemImage alloc] initWithNormalSprite:[CCSprite spriteWithSpriteFrame:[[CCSpriteFrameCache sharedSpriteFrameCache] spriteFrameByName:@"close-bttn.png"]] selectedSprite:nil disabledSprite:nil block:^(id sender)
{
[self hideProgressBarForDownload];
[[NSNotificationCenter defaultCenter] postNotificationName:kNotificationInAppLayerClosed object:self userInfo:nil];
[[GameManager sharedGameManager]setCurrentLayer:-1];
[self removeFromParentAndCleanup:YES];
}];
While when it is clicked, following methods are call in a hierachy
-(void) hideProgressBarForDownload
{
[[DownloadManager sharedDownloadManager]removeAllProgressbarsIfvisible];
}
-(void)removeAllProgressbarsIfvisible
{
NSArray * allkeys = [currentDownloads allKeys];
for (int i = 0; i < [allkeys count]; i++)
{
NSString *key = [allkeys objectAtIndex:i];
DownloadItem * item = [currentDownloads valueForKey:key];
UIProgressView * progress = item.progressIndicator;
//progress.hidden = YES;
if (progress.superview)
{
[progress removeFromSuperview];
}
}
}
I guess every piece of code is right but don't know why they are not removing.
Thanks in advance.