• 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: Implementing -willDisplayCell... delegate method for NSMatrix [SOLVED]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Implementing -willDisplayCell... delegate method for NSMatrix [SOLVED]


  • Subject: Re: Implementing -willDisplayCell... delegate method for NSMatrix [SOLVED]
  • From: "Lawrence Sanbourne" <email@hidden>
  • Date: Sat, 13 May 2006 00:10:00 -0500

On 5/12/06, Lawrence Sanbourne <email@hidden> wrote:
I know what you're thinking, NSMatrix doesn't have a
-willDisplayCell... delegate method. However, I need a good place to
set cell attributes before displaying them (an image, in my case), so
I'm trying to create a delegate method (for an NSMatrix subclass) that
will accomplish exactly what NSTableView's delegate accomplishes.

Sorry, should have persisted longer before writing to the list. I put this in an overridden -drawRect method and it works:

	// Notify all cells within the rect that they are about to be displayed.
	int rowIndex, numRows = [self numberOfRows];
	int columnIndex, numColumns = [self numberOfColumns];
	for (rowIndex = 0; rowIndex < numRows; ++rowIndex) {
		for (columnIndex = 0; columnIndex < numColumns; ++columnIndex) {
			NSCell *cell = [self cellAtRow:rowIndex column:columnIndex];
			NSRect cellFrame = [self cellFrameAtRow:rowIndex column:columnIndex];

			if ([self needsToDrawRect:cellFrame]) {
				if ([[self delegate]
respondsToSelector:@selector(matrix:willDisplayCellAtRow:column:)])
					[[self delegate] matrix:self willDisplayCellAtRow:rowIndex
column:columnIndex];
			}
		}
	}

Only now, my problem is that the cell drawing code is too slow during
a live resize. When I remove a -compositeToPoint call, suddenly it's
super-fast. Time to figure out how to fix this.

Larry
_______________________________________________
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


  • Prev by Date: OT? Creating a screencasting application...
  • Next by Date: Re: Should objects returned by indirection be autoreleased
  • Previous by thread: Re: OT? Creating a screencasting application...
  • Next by thread: Using NSImages as keys to a dictionary
  • Index(es):
    • Date
    • Thread