On Thu, Jul 1, 2010 at 2:41 AM, Stefan Jung <[email protected]> wrote:
> 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)

Yes, this is an error. Resizing yourself in -drawRect: is a great way
to explode.

Assuming you are following correct MVC design principles, your view
has a method along the lines of -setData: that your controller object
uses to inform the view of new model data. It is in this method that
you should recalculate your size. This will mark your view dirty,
which will cause it to get a -drawRect: on the next window refresh
cycle, at which time you will draw your new data.

--Kyle Sluder
_______________________________________________

Cocoa-dev mailing list ([email protected])

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to