FROM : chataka
DATE : Fri Nov 23 10:27:32 2007
Hi, all.
I am trying to add an NSView (view) on an NSWindow (window) but I'm
having
a trouble with setNeedsDisplay of NSView.
In a method, I add a view to a window's contentView, then call
setFrame: display.
The view is displayed when the method is called for the first time,
but it is not
displayed next time the same method is called.
I checked [view needsDispay] in the method and as it was NO when the
view was
not displayed, I added [view setNeedsDisplay: YES].
But what was strange was [view needsDisplay] was still NO even after
[view setNeedsDisplay: YES] was added.
BOOL beforeSet = [view needsDisplay];
[view setNeedsDisplay: YES];
BOOL afterSet = [view needsDisplay];
I added above code in the method to see if [view needsDisplay] changed,
and both beforeSet and afterSet were NO.
There is no code between the lines so [view setNeedsDisplay: YES] seems
not to be working as I expect, but in what case does this happen and how
can I set needsDisplay YES?
The view is connected to an NSView in nib file. As it is displayed when
the method is called for the first time, it is correctly connected.
Thank you.
- Chataka
DATE : Fri Nov 23 10:27:32 2007
Hi, all.
I am trying to add an NSView (view) on an NSWindow (window) but I'm
having
a trouble with setNeedsDisplay of NSView.
In a method, I add a view to a window's contentView, then call
setFrame: display.
The view is displayed when the method is called for the first time,
but it is not
displayed next time the same method is called.
I checked [view needsDispay] in the method and as it was NO when the
view was
not displayed, I added [view setNeedsDisplay: YES].
But what was strange was [view needsDisplay] was still NO even after
[view setNeedsDisplay: YES] was added.
BOOL beforeSet = [view needsDisplay];
[view setNeedsDisplay: YES];
BOOL afterSet = [view needsDisplay];
I added above code in the method to see if [view needsDisplay] changed,
and both beforeSet and afterSet were NO.
There is no code between the lines so [view setNeedsDisplay: YES] seems
not to be working as I expect, but in what case does this happen and how
can I set needsDisplay YES?
The view is connected to an NSView in nib file. As it is displayed when
the method is called for the first time, it is correctly connected.
Thank you.
- Chataka
| Related mails | Author | Date |
|---|---|---|
| chataka | Nov 23, 10:27 | |
| Andreas Mayer | Nov 23, 11:23 | |
| chataka | Nov 23, 17:40 |






Cocoa mail archive

