osx - Custom-drawn NSView Redraws Whole View Inside Edited Subviews -
I have an NSView that is displaying a custom background with an image, but whenever I press a button Or edit the labels in the program, it seems that the image of the background pulls it back into the edited sub-view. I have found that by solving the issue by creating the scene layer in the IB, but in the larger app I am making, the cause of the scene layer backup causes many other issues.
I have made it, for example, to clearly show the app clearly what is happening. There is another image after pressing the button, which edits the labels text programmatically, it seems as if the background image starts at the top of the button and is coming around both the buttons and the label.
This view is being made like this:
- (zero) direct: (NSRctact) Gandrecht {{[Nsimage image nominated: @ "Redgreengridged.png" ] Draw Incente: From the dungeon: NSGroRyct Operation: NSCMopozetosSourceAppear: 1]; }
Before editing:
after editing:
Is there a scene that I can decide without layer-backing the view?
(sorry about gross shield - I thought my point is clear)
The dirty rect
parameter that is being passed in -drawRect:
is not the full threshold rectangle of your view, but the rectangle marked as the need for an update (Like "dirty" rectangle, as the name suggests).
When you press the button or edit the label, it only invalidates the display status for the bounding rectangle of that subview and therefore only causes that rectangle to be dirtyRect
Is being passed in the form. So what you are seeing in those screenshots is being drawn into a small rectangle inside the border of your view.
In your case, you should only see -drawRect:
using the self.bounds
instead of dirtyRect
instead of drawing rectangle ):
- (zero) drawRect: (NSRact) Dirty Rect ([Nsimage image nominated: @ "Red Green Gradient BG. Png"] Draw Innerct: From Self. Bunders: NSGrOrite Operation: NSCMOVO Source Source: 1]; }
Comments
Post a Comment