redraw weirdness (setFrameSize in drawRect)
redraw weirdness (setFrameSize in drawRect)
- Subject: redraw weirdness (setFrameSize in drawRect)
- From: Stefan Jung <email@hidden>
- Date: Thu, 1 Jul 2010 11:41:18 +0200
I have a little program that loads data, converts them and then displays these data in a custom view.
There are no errors or warnings. If the data are scaled into the view, everything works as expected.
Now I wanted to use a scroll view instead of scaling on the horizontal axis.
I put
[self setFrameSize:NSMakeSize(numberOfDataPoints+1, height)];
into the drawRect: method. (May be a logical error)
This works in a way, but if I first display a small amount of data without the need of scrolling (looks OK) and then reload a big amount where scrolling is necessary, then the old bezierPath (from the old data) is still drawn on the left side of the scroll view and the new data continue on the right. It looks like the new data are just added at the end of the old path, though the bezierPath is created in the drawRect method. There seems to be a buffering problem.
The setNeedsDisplay: method is called from the controller (after putting the new data into the array that is then used for bezier path creation) and in viewDidEndLiveResize:. Resizing the window corrects the problem.
Even weirder: When I use [self setFrameSize:NSMakeSize(numberOfDataPoints, height)]; , that means not adding a 1 to the numberOfDataPoints, the data are not displayed at all!? Resizing helps. This totally befuddles me. I don’t see the logic behind this.
Moving the setFrameSize: method to the controller after data assignment and right before setNeedsDisplay: is the cure, but I would like to understand what happens.
Best Regards,
Stefan
Attachment:
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________
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