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

  • Home
  • SEARCH
  • 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 8509493
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T03:26:58+00:00 2026-06-11T03:26:58+00:00

This might seem like a basic question but I’m still getting a handle on

  • 0

This might seem like a basic question but I’m still getting a handle on properties so please bear with me.

I have a custom NSView subclass that does its own drawing. I’ve set up support for different styles with a @property for setters and a typedef enum for human-readable integers. It works great, but the view won’t redraw after setting its style unless I manually call setNeedsDisplay:YES on the control or resize its parent window.

Logically one would think the solution would be to simply do a [self setNeedsDisplay:YES] in the classes’ setStyle: method, but I cannot for the life of me figure out how to properly do it. Whenever I try to override setStyle: it just complains, “Writable atomic property ‘style’ cannot pair a synthesized getter with a user defined setter”.

What should be done in this situation?

  • 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-11T03:26:59+00:00Added an answer on June 11, 2026 at 3:26 am

    Ideally, you would just declare your actual ivar/storage as a private property, then manually implement the setter setStyle:. In the implementation of setStyle:, set your private property/state, and perform your updates. So you just abstract the data from the client’s interface. There are other ways to approach this, such as directly setting the ivar.

    So an implementation may take the form:

    MONThing.h

    @interface MONThing : NSObject
    
    - (void)setStyle:(t_style)pStyle; // << the client's interface
    
    @end
    

    MONThing.m

    @interface MONThing ()
    
    @property (nonatomic, assign, readwrite) t_style userStyle; // << the actual storage
    
    @end
    
    @implementation MONThing
    
    - (void)setStyle:(t_style)pStyle
    {
        // validate parameter
        // set our data
        self.userStyle = pStyle;
        // perform effects
        [self setNeedsDisplay:true];
    }
    

    Over time, you will learn multiple ways to accomplish this, and when you would favor one over the other.

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

Sidebar

Related Questions

This might seem like a weird question, but bear with me. I'd like to
This might seem like a basic question and back to Http protocol 101. But
This might seem like a really basic question but, When dividing the output of
This might seem like a very easy question for some of you folks, but
This might seem like a trivial question, but I'm a bit muddled in my
I know this might seem like a duplicate, but I'm not getting anywhere with
This might sound like an obvious question but I can't seem to find the
I've just started learning jQuery/javascript, so this might seem like a really basic question,
I have a question that might seem basic but I just cannot figure out
This might seem a bit like a do-my-homework-for-me question (and it is), but I

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.