• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Easier way to make NSView subclasses refresh on a property change?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Easier way to make NSView subclasses refresh on a property change?


  • Subject: Easier way to make NSView subclasses refresh on a property change?
  • From: Graham Cox <email@hidden>
  • Date: Wed, 03 Feb 2016 17:05:05 +1100

Hi all,

Whenever I make a custom view class, it often has a bunch of properties that affect the content it renders. So, for each setter that does this, I have to override the setter, do whatever it normally does plus call -setNeedsDisplay:YES.

This gets tedious.

Is there a good way to automate this for a given set of properties? I considered overriding -didChangeValueForKey: and checking the key against a set of exported property names, and that would work, except all my custom views would then need to subclass this one special kind of view instead of NSView. Can it be done with a standard NSView? (MacOS)

A similar requirement applies to CALayer too.

—Graham



_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden


  • Follow-Ups:
    • Re: Easier way to make NSView subclasses refresh on a property change?
      • From: Lee Ann Rucker <email@hidden>
    • Re: Easier way to make NSView subclasses refresh on a property change?
      • From: Keary Suska <email@hidden>
    • Re: Easier way to make NSView subclasses refresh on a property change?
      • From: Graham Cox <email@hidden>
  • Prev by Date: UIViews in SpriteKit Apps
  • Next by Date: Re: Easier way to make NSView subclasses refresh on a property change?
  • Previous by thread: Re: UIViews in SpriteKit Apps
  • Next by thread: Re: Easier way to make NSView subclasses refresh on a property change?
  • Index(es):
    • Date
    • Thread