Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8644747
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T12:22:33+00:00 2026-06-12T12:22:33+00:00

Im displaying a badge using CustomBadge with this code: -(void)viewWillAppear:(BOOL)animated{ [self fillBadges]; //********** Start

  • 0

Im displaying a badge using CustomBadge with this code:

-(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];

}

When allBadge count is less than 1, I don’t want the badge to show. How do I remove or hide it from the view.

Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T12:22:34+00:00Added an answer on June 12, 2026 at 12:22 pm

    Create a class-wide variable for your customBadgeAll:

    in your .h:

    CustomBadge *customBadgeAll;
    

    then you can easily remove the badge again:

    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];      
    }
    else{
      [customBadgeAll removeFromSuperview];
    }
    

    Another way would be to set a the tag value of customBadgeAll to a special value and later retrieving it using [self.view viewWithTag:...].

    Hope this helps

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm currently displaying a UIViewController like this: [[self navigationController] presentModalViewController:modalViewController animated:YES]; and hiding it
When displaying all articles of a specific month (given through the urls like this
I'm displaying records in a grid format from an ActiveRecord list using each_slice. What
I'm displaying a webpage (html) kept in my assets folder using a webView .
For displaying the character & in a button as text, i am using &&
in displaying an array in lua, it always start with 1, so i used
I'm displaying my categories using the wp_list_categories function like so: <?php wp_list_categories('selected=6&title_li='); ?> Now,
For displaying hyperlink on a page on my android app I am doing this:
For displaying little avatar photos i use $this->itemPhoto(_someID_, 'thumb.icon') , so 'thumb.icon' argument makes
I'm displaying a set of images as an overlay using Google Maps. Displaying these

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.