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 8020261
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T21:38:22+00:00 2026-06-04T21:38:22+00:00

I am flipping the value of a simple BOOL like this: active = !active;

  • 0

I am flipping the value of a simple BOOL like this:

active = !active;
NSLog(@"%@", active? @"active" : @"not active");

I’ve done this numerous times but right now, for some reason it’s not working and it’s really pissing me off. When ever the flow hits here, it always prints “active”. It’s not switching!!

Here’s my interface:

@interface HeaderView : UIView {
    UILabel *label;
    UIButton *button;
    UIImageView *background;
    BOOL active;
    int section;

    __weak id<HeaderViewDelegate> delegate;
}

and function where the action is performed:

- (void)actionTUI:(id)sender {
    active = !active;
    NSLog(@"%@", active? @"active" : @"not active");
    UIImage *image = nil;
    if (active) {
        image = [UIImage imageNamed:@"active.png"];
    } else {
        image = [UIImage imageNamed:@"unactive.png"];
    }
    [button setBackgroundImage:image forState:UIControlStateNormal];
    [delegate headerView:self toggled:active];
}

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-04T21:38:24+00:00Added an answer on June 4, 2026 at 9:38 pm

    Ok, the problem was that after toggling, I was reloading the tableview which apparently recalls:

    - (UIView *)tableView:(UITableView *)_tableView viewForHeaderInSection:(NSInteger)section {
    

    which caused a new header view to be allocated/initialized with active set to NO and right after toggling, set to YES. That’s why every time, even after flipping the values it was set to active (because right after, it would get discarded and a new header view would come to it’s place).

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

Sidebar

Related Questions

I would like to convert programmatically convert a PDF document to a Flash flipping
Flip is a great JQuery plugin for flipping blocks, but it doesn't preserve the
I want to create a page flipping transition for an iPhone app like the
So, I'm trying to create a tile flipping effect, like on Windows Phone 7.
I am doing a simple coin flipping experiment for class that involves flipping a
I would like to know the respective graphics transformations ..in creating a flipping effect
I wants to make a GUI application with some fancy graphics, like flipping the
Is there a simple way to do the Curl page flipping animation? A Curl
I am flipping view through this code (void) displayView:(UIViewController*)newView { [UIView beginAnimations:nil context:NULL]; [UIView
In this project I'm working on they made divs that look like textboxes that

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.