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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T23:43:44+00:00 2026-06-01T23:43:44+00:00

I custom draw my TableView Cells by defining a macro #define DRAW_SET 1 Somewhere

  • 0

I custom draw my TableView Cells by defining a macro #define DRAW_SET 1

Somewhere throughout the life cycle of the app I want to change the appearance of the cells, so I implemented an IBAction method that then #undef DRAW_SET the macro and defines it with a value of 2 #define DRAW_SET 2.

The issue that I am having is that the macro is not being undefined and/or redefined. Could this be due to public/private calls?

Thanks, Clinton

  • 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-01T23:43:46+00:00Added an answer on June 1, 2026 at 11:43 pm

    Macros are compiler instructions. After compilation, every macro is replaced with the corresponding value / statement. #undef lets you undefine a macro, but again, as part of the compilation logic, not runtime logic.

    Typically macros are used for statically adding debug code during the development cycle, then removing it when you deploy your app (to keep the size down). For example:

    #ifdef DEBUG
    
    // regular logic you don't want in your final app
    
    #endif
    

    Another place I have used macros is when targeting different operating systems:

    #ifdef WINDOWS
    
    // something windows specific
    
    #endif
    
    #ifdef AIX
    
    // something AIX specific
    
    #endif
    

    These macros can be defined in various places – your compiler will give you a lot of them for free and you can set them as part of your build process.

    But the key thing here is, they are not changeable at runtime.

    What you probably want to do is define a variable somewhere, maybe on your application delegate as a property, which is fairly easy to access from anywhere in your app:

    YourAppDelegate *appDelegate = (YourAppDelegate *)[[UIApplication sharedApplication] delegate];
    

    Then in your code look at the variable that’s been set:

    if (appDelegate.myFlag == 1) {
        // render my cell in one way
    } else {
        // render my cell in another way
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to draw a custom TabControl with custom functionality. To do this, i
I've created a custom view class and right now just want to draw an
I have some custom table view cells that takes a while to draw, so
I want to draw custom button on Navigation bar. Can anybody help me.
My application has a tableview with custom cells(include textfield, label and button), I wanna
I want to draw a custom NSWindow that allows me to add subviews even
I want to draw custom elements (like an empty square> between the items of
I want to draw a custom version of a JFrame. Is is possible to
I want to draw custom static shapes in my game just like the angry
I am learning PyQt and wonder if one can create custom/owner draw control like

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.