• 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
Subclassing appendFormat: for NSMutableString?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Subclassing appendFormat: for NSMutableString?


  • Subject: Subclassing appendFormat: for NSMutableString?
  • From: "Dr. H. Nikolaus Schaller" <email@hidden>
  • Date: Sun, 16 May 2004 16:22:24 +0200

Hi,

I have tried to subclass NSMutableString and learned that it is a Class Cluster which can not be subclassed unless I want to add more internal string representations (which is NOT what I want).

What I want is a class that behaves in some aspects like a NSMutableString but has additional instance variables. A typical candidate for subclassing.

Documentation recommends: Write a subclass of NSObject that manages an NSMutableString as an instance variable and write wrapper methods.

Well, but how do I wrap appendFormat: which is the most important method I intend to provide by the subclass?

There seems to be no chance to get the intended behaviour:

a) no Subclass of NSMutableString - because it is a class cluster
b) no Wrapper around NSMutableString - because you can't wrap methods with variable argument lists
c) no Category of NSMutableString - because you can't add instance variables to a Category

The only idea I have is use b) and leave out the appendFormat: method and replace its calls by [myobject appendString:[NSString stringWithFormat:...]]. It a little ugly and wasting space&time.

Seems to be a missing functionality of Objective-C/Cocoa. Or do I miss something?

Nikolaus
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.


  • Follow-Ups:
    • Re: Subclassing appendFormat: for NSMutableString?
      • From: Ben Dougall <email@hidden>
    • Re: Subclassing appendFormat: for NSMutableString?
      • From: Ondra Cada <email@hidden>
References: 
 >keeping tooltips from wrapping (From: Mark Munz <email@hidden>)

  • Prev by Date: Re: window rotation
  • Next by Date: Re: NSTableView not scrolling.
  • Previous by thread: keeping tooltips from wrapping
  • Next by thread: Re: Subclassing appendFormat: for NSMutableString?
  • Index(es):
    • Date
    • Thread