• 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: Dynamically update drawRect
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Dynamically update drawRect


  • Subject: Re: Dynamically update drawRect
  • From: proger proger <email@hidden>
  • Date: Sun, 27 Dec 2009 11:18:06 +0200

I'm still don't know how to do it. As solution i see programmically create
MyView class and call drawRect function as i needed. Because now
MyView(NSView) is created by nib. And i can't call MyView class instance
methods. How to programmically add Custom View and set MyView class ?

On Sun, Dec 27, 2009 at 12:33 AM, Quincey Morris <
email@hidden> wrote:

> On Dec 26, 2009, at 13:58, Gideon King wrote:
>
> > DrawRect is not called directly by you - instead, you use
> setNeedsDisplayInRect: and setNeedsDisplay: to tell the system the dirty
> rect to redraw, and those rects are combined before the system locks focus
> on your view and calls drawRect:/ You therefore can't pass information to
> your drawing method - you have to use the state information you set in your
> program to work out how to draw the rects you need to draw.
> >
> > HTH
> >
> > Gideon
> >
> >> I have two classes. One for internet connection(program logic) and one
> to
> >> display graphics(i posted code). And i want to call drawRect from
> another
> >> class and pass some data to drawRect method. Seems like drawRect method
> is
> >> just for static graphics. Does there's any possibility to do it ? Any
> >> examples ?
>
>
> In any case, it seems like short-sighted design to have a view's drawing
> methods called directly by another class (even if the concept made sense in
> the Cocoa scheme of things). Rather, provide a method for other classes to
> call that specifies their rect of interest and other parameters, and have
> that method decide how to get things drawn accordingly. This might be as
> simple as stashing the parameters in instance variables and invoking '[self
> setNeedsDisplayInRect: suppliedRect]', but might also get more sophisticated
> if there might be *multiple* invocations before drawing actually occurs, in
> which case you'd have to decide how to resolve the various sets of possibly
> conflicting parameters, right?
>
>
> _______________________________________________
>
> 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
>
_______________________________________________

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

  • Follow-Ups:
    • Re: Dynamically update drawRect
      • From: Quincey Morris <email@hidden>
    • Re: Dynamically update drawRect
      • From: Andrew Farmer <email@hidden>
References: 
 >Dynamically update drawRect (From: proger proger <email@hidden>)
 >Re: Dynamically update drawRect (From: Gideon King <email@hidden>)
 >Re: Dynamically update drawRect (From: Quincey Morris <email@hidden>)

  • Prev by Date: Re: UITextfield print to NSLog
  • Next by Date: Re: Dynamically update drawRect
  • Previous by thread: Re: Dynamically update drawRect
  • Next by thread: Re: Dynamically update drawRect
  • Index(es):
    • Date
    • Thread