• 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
Re: Custom NSView subclass - expressing the fact that a property affects the displayed image
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Custom NSView subclass - expressing the fact that a property affects the displayed image


  • Subject: Re: Custom NSView subclass - expressing the fact that a property affects the displayed image
  • From: Jerry Krinock <email@hidden>
  • Date: Sat, 23 May 2015 14:49:57 -0700

> On 2015 May 23, at 07:10, Marek Hrušovský <email@hidden> wrote:
>
> Haven't read all the thread but i would use a custom property with overridden setter to call setNeedsDisplay with combination of keyPathsForValuesAffectingValueForKey: I think you can get rid of the glue code.

Yes, but you don’t need an overridden setter.  Amy Worral explains it here:

http://stackoverflow.com/questions/6354368/how-to-observe-change-in-nsobject-properties

My interpretation is to declare a phantom property such as

@property NSInteger lookMaStuffChanged ;

then,

+ (NSSet*)keyPathsForValuesAffectingValueForLookMaStuffChanged {
    return [NSSet alloc] initWithObjects:
        @“whatever1”,
        @“whatever2”,
        …
        nil] ;
}

Finally, observe lookMaStuffChanged with KVO.

In fact, the phantom property lookMaStuffChanged is never affected by anything; it’s never even set to anything.

Works for me.


_______________________________________________

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


References: 
 >Custom NSView subclass - expressing the fact that a property affects the displayed image (From: Jonathan Taylor <email@hidden>)
 >Re: Custom NSView subclass - expressing the fact that a property affects the displayed image (From: Graham Cox <email@hidden>)
 >Re: Custom NSView subclass - expressing the fact that a property affects the displayed image (From: Jonathan Taylor <email@hidden>)
 >Re: Custom NSView subclass - expressing the fact that a property affects the displayed image (From: Marek Hrušovský <email@hidden>)

  • Prev by Date: Re: NSMutableDictionary Look Up
  • Next by Date: Re: iOS App Store Version vs Info.plist version?
  • Previous by thread: Re: Custom NSView subclass - expressing the fact that a property affects the displayed image
  • Next by thread: Re: Custom NSView subclass - expressing the fact that a property affects the displayed image
  • Index(es):
    • Date
    • Thread