我使用带有此代码的 CustomBadge 显示徽章:
-(void)viewWillAppear:(BOOL)animated{
[self fillBadges];
//********** Start Custom Badge ***************//
NSString *myNewString = [NSString stringWithFormat:@"%i",allBadge];
if (allBadge >= 1) {
NSLog(@"Add One");
CustomBadge *customBadgeAll = [CustomBadge customBadgeWithString:myNewString];
[customBadgeAll setFrame:CGRectMake(125, 90, customBadgeAll.frame.size.width, customBadgeAll.frame.size.height)];
[self.view addSubview:customBadgeAll];
}
//********** End Custom Badge ***************//
[self.view setNeedsDisplay];
[[self navigationController] setNavigationBarHidden:NO animated:NO];
}
当 allBadge 计数小于 1 时,我不希望显示徽章。如何从视图中删除或隐藏它。
谢谢