• 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: Subclass of NSMutableDictionary hanging
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Subclass of NSMutableDictionary hanging


  • Subject: Re: Subclass of NSMutableDictionary hanging
  • From: Nick Forge <email@hidden>
  • Date: Sun, 4 Mar 2007 14:54:12 +1100

OK, so it seems like you can't (simply) subclass some NSxxx data objects... why is that? I have successfully subclassed some GUI NSxxx objects with no problems.

In this situation I can very easily just have my own object wrapper that contains and maintains an nsdictionary - but I'm still interested as to why normal subclassing doesn't work like it does in other OO languages. From reading this page:

http://developer.apple.com/documentation/Cocoa/Conceptual/ CocoaFundamentals/CocoaObjects/chapter_3_section_9.html

I am pretty lost as to why you have to add all of the seemingly redundant "glue code" for all of the primitive methods. Can you just write all of the primitive methods as:

- (void)someMethod:(NSObject *)x
{
	[super someMethod:x];
}

Or am I missing something? {scratches head...}



On 04/03/2007, at 7:26 AM, Jerry Krinock wrote:
on 07/03/03 10:10, Keary Suska at email@hidden wrote:

If your member count is large or varies significantly you could have a
custom object that maintains a dictionary and override the KVC
-valueForUndefinedKey methods in your object for transparent access to the
dictionary.


Yes, this is a cool trick; think of it as a "thin wrapper" around NSMutable
Dictionary. It's quite easy to convert an existing NSMutableDictionary into
one of these.




_______________________________________________

Cocoa-dev mailing list (email@hidden)

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: 
 >Re: Subclass of NSMutableDictionary hanging (From: Jerry Krinock <email@hidden>)

  • Prev by Date: Removing formatting goo from NSRulerView subclass...
  • Next by Date: Notifications
  • Previous by thread: Re: Subclass of NSMutableDictionary hanging
  • Next by thread: Re: Subclass of NSMutableDictionary hanging
  • Index(es):
    • Date
    • Thread