My application needs to draw hundreds of short
text strings into an NSView. After reviewing the
Cocoa documentation on drawing text, I am left
unsure as to how to do this with the highest
level of efficiency.
The text I am drawing will all be the same font
and font size and style; the color may vary
however. Taking advantage of the fact that the
font size/style is invariant would seem to be a
useful thing to do.
The text is not tabular; the starting point for
each string could be anywhere within the view. We
could say, for purposes of discussion, that the
origin for each chunk of text are, in essence,
"random".
Using the NSString "convenience functions" would
not seem the best route since the documentation
says "These methods are designed for drawing
small amounts of text or text that must be drawn
rarely. They create and dispose of various
supporting text objects, including
NSLayoutManager, every time you call them."
(Reference:
http://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/TextLayout/Tasks/DrawingStrings.html)
Using NSCell seems a good alternative because
they are "lightweight". But in the same document
cited above, it says "for the most efficient
display of an arbitrary text string, use
NSLayoutManager directly." But since
NSLayoutManager seems to want to deal with a
single NSTextContainer as it's source, this
somehow doesn't seem to be a good solution for my
problem.
Any guidance regarding the method that will give
me the highest performance would be most
appreciated.
Thanks in advance,
Mark
--
_______________________________________________
Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com
This email sent to arch...@mail-archive.com