• 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
Custom drawing in IKImageBrowserView fails
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Custom drawing in IKImageBrowserView fails


  • Subject: Custom drawing in IKImageBrowserView fails
  • From: Florian Soenens <email@hidden>
  • Date: Wed, 25 Nov 2009 14:34:29 +0100

Hi list,

i'm trying to override an IKImageBrowserView to do some custom drawing but i'm stuck.
What i try to accomplish is that when the view contains zero items, some custom drawing happens like drawing an NSAttributedString that says "Drop items here..."
Problem is that my drawing code gets never called.

Here's the drawRect method of my IKImageBrowserView:

- (void)drawRect:(NSRect)rect
{
	[super drawRect:rect];

	NSUInteger numItems = [[self dataSource] numberOfItemsInImageBrowser:self];

	if(numItems <= 0)
	{
		NSLog(@"No items in me"); // This gets called, so i'm sure the above code works

		NSRect bounds = [self bounds];
		bounds.size.width = 200;
		bounds.size.height = 200;
		bounds.origin.x += 200;
		bounds.origin.y += 200;

		//[NSGraphicsContext saveGraphicsState];

		[[NSColor yellowColor] set]; // Just for testing purposes
		NSRectFill(bounds);

		//[NSGraphicsContext restoreGraphicsState];
	}
}

Uncommenting the NSGrahicsContext doesn't help either.

Anyone has any ideas or workarounds for this?
Thanks in advance,
Florian
_______________________________________________

Cocoa-dev mailing list (email@hidden)

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:

This email sent to email@hidden

  • Follow-Ups:
    • Re: Custom drawing in IKImageBrowserView fails
      • From: Thomas Goossens <email@hidden>
  • Prev by Date: Re: GC, variable optimized away wrongly?
  • Next by Date: Re: Custom drawing in IKImageBrowserView fails
  • Previous by thread: Re: GC, variable optimized away wrongly?
  • Next by thread: Re: Custom drawing in IKImageBrowserView fails
  • Index(es):
    • Date
    • Thread