• 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: All seems well but image doesn't show up.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: All seems well but image doesn't show up.


  • Subject: Re: All seems well but image doesn't show up.
  • From: Michael Watson <email@hidden>
  • Date: Mon, 23 Jul 2007 00:53:54 -0400

Have you read the Cocoa views guide yet? It explains why your code didn't do what you expected it to do. In a nutshell, -drawRect: is where all of the view's drawing happens. If you implement -drawRect: and don't put any drawing code there, nothing gets drawn.

<http://developer.apple.com/documentation/Cocoa/Conceptual/ CocoaViewsGuide/index.html>

specifc example of using -drawRect: here

<http://developer.apple.com/documentation/Cocoa/Conceptual/ CocoaViewsGuide/SubclassingNSView/chapter_5_section_3.html>


-- m-s



On 22 Jul, 2007, at 22:30, David Arnold wrote:

Chris et al,

Nice going Chris! Thanks.

Commenting out the code

/*
 - (void)drawRect:(NSRect)rect {
    // Drawing code here.
}
*/

cured the problem.

However, I am so new to this, I can't say that I "see" the problem. I used the File Assistant to subclass an NSView class, so the drawRect command was put there by the XCode machinery. A naive guess would be that an empty drawRect method would cause an empty NSView, but I cannot say for certain why the lines

- (void)windowDidLoad
{
	NSImage *image = [[self document] activeImage];
	NSLog(@"%@",image);
	[view setImage:image];

in the IAWindowController still don't provide an image.

And finally, when we get ourselves into these situations, other than pouring over the code again, what good ideas come to mind to debug the source of the problem?


On 23/07/2007, at 11:37 AM, David Arnold wrote:

1. What I can do to fix the problem, and

Well, in IAImageView (your subclass of NSImageView) you've overridden drawRect:


- (void)drawRect:(NSRect)rect {
}

Can you see the problem?

- Chris


_______________________________________________

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:
40bungie.org


This email sent to email@hidden

_______________________________________________

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


References: 
 >All seems well but image doesn't show up. (From: David Arnold <email@hidden>)
 >Re: All seems well but image doesn't show up. (From: Chris Suter <email@hidden>)
 >Re: All seems well but image doesn't show up. (From: David Arnold <email@hidden>)

  • Prev by Date: Re: Saving images to MySQL
  • Next by Date: Which profile is applied in converting PDF/EPS images from CMYK to RGB?
  • Previous by thread: Re: All seems well but image doesn't show up.
  • Next by thread: Re: All seems well but image doesn't show up.
  • Index(es):
    • Date
    • Thread