• 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: Design Question: Pro & Cons of KVC/KVO
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Design Question: Pro & Cons of KVC/KVO


  • Subject: Re: Design Question: Pro & Cons of KVC/KVO
  • From: Phil <email@hidden>
  • Date: Fri, 22 Aug 2008 16:22:52 +1200

On Fri, Aug 22, 2008 at 3:59 PM, Kyle Sluder
<email@hidden> wrote:
> @implementation ToolBar
> {
>    -(id) init
>    {
>        [[[NSNotificationCenter] defaultCenter] addObserver:self
> selector:@selector(splitViewResized:) object:mySplitView];
>    }

-(void)dealloc
{
    [[NSNotificationCenter] defaultCenter] removeObserver:self];
    [super dealloc];
}
@end

I've generally only used notifications for events that can't be
handled with KVO---ie. those that aren't associated with a property
change; and I've noticed that this is generally the trend in Cocoa
frameworks as well. Why use NSNotifications when there's already
perfectly good notification mechanism?

That said, notifications also give you a lot more flexibility about
when observers will be called, and coalescence of multiple
notifications.

Phil
_______________________________________________

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: Design Question: Pro & Cons of KVC/KVO
      • From: Graham Cox <email@hidden>
References: 
 >Design Question: Pro & Cons of KVC/KVO (From: "Oleg Krupnov" <email@hidden>)
 >Re: Design Question: Pro & Cons of KVC/KVO (From: Negm-Awad Amin <email@hidden>)
 >Re: Design Question: Pro & Cons of KVC/KVO (From: "Oleg Krupnov" <email@hidden>)
 >Re: Design Question: Pro & Cons of KVC/KVO (From: Negm-Awad Amin <email@hidden>)
 >Re: Design Question: Pro & Cons of KVC/KVO (From: "Oleg Krupnov" <email@hidden>)
 >Re: Design Question: Pro & Cons of KVC/KVO (From: Negm-Awad Amin <email@hidden>)
 >Re: Design Question: Pro & Cons of KVC/KVO (From: "Oleg Krupnov" <email@hidden>)
 >Re: Design Question: Pro & Cons of KVC/KVO (From: Graham Cox <email@hidden>)
 >Re: Design Question: Pro & Cons of KVC/KVO (From: "Kyle Sluder" <email@hidden>)

  • Prev by Date: Re: Preventing windows from being dragged
  • Next by Date: Re: Source List groups shifted down in NSOutlineView
  • Previous by thread: Re: Design Question: Pro & Cons of KVC/KVO
  • Next by thread: Re: Design Question: Pro & Cons of KVC/KVO
  • Index(es):
    • Date
    • Thread