• 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: NSTextFieldCell Subclass for Image+Text, any faster way?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSTextFieldCell Subclass for Image+Text, any faster way?


  • Subject: Re: NSTextFieldCell Subclass for Image+Text, any faster way?
  • From: PGM <email@hidden>
  • Date: Mon, 20 Nov 2006 23:20:12 -0500

I actually tried and the performance is very well, my tableView scrolled without any problems. Here's the code I used; I would appreciate it if anybody could point out an easier way to work with attachmentCells in a mutableAttributedString

NSTextAttachment* attachment = [[[NSTextAttachment alloc] init] autorelease];
[(NSCell *) [attachment attachmentCell] setImage:[NSImage imageNamed:@"yourImage.tif"]];

NSMutableAttributedString *aString = [[[NSAttributedString attributedStringWithAttachment:attachment] mutableCopy] autorelease];
[[aString mutableString] appendString:@"Hello, world!"];
return aString;


Patrick

On 20-Nov-06, at 22:49 PM, Brian Amerige wrote:

Hi all,

I've been playing with a whole lot of subclasses which all do essentially the same thing, in the same way. They're subclasses of NSTextFieldCell, one even from Apple named ImageAndTextCell, and they all work nicely, with the exception of one thing: speed!

They're quite fine for simple things like TableView's with say, 5 items, but seriously, once I pass 20 or so items, actions are painful in regard to the subclass! This makes sense to me because it's actually redrawing the cell every-time you, say resize the window, scroll, highlight all, etc.

My question is: Is it possible to have do draw an image (16x16) in the same cell as text, without it being a total resource hog, and reasonable for usage in real-world scenarios?

If not, I've experimented with placing the image in a separate column, which was far better performance wise, but was unsightly because of the header divider. In this case, can I "hide" the header divider?

Thanks,
Brian Amerige.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
40sympatico.ca


This email sent to email@hidden

_______________________________________________ Do not post admin requests to the list. They will be ignored. Cocoa-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
References: 
 >NSTextFieldCell Subclass for Image+Text, any faster way? (From: Brian Amerige <email@hidden>)

  • Prev by Date: Re: NSMatrix + custom cell + bindings == crash??? EXC_ARITHMETIC
  • Next by Date: Re: NSTextFieldCell Subclass for Image+Text, any faster way?
  • Previous by thread: Re: NSTextFieldCell Subclass for Image+Text, any faster way?
  • Next by thread: Re: NSTextFieldCell Subclass for Image+Text, any faster way?
  • Index(es):
    • Date
    • Thread