• 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: Quincey Morris <email@hidden>
  • Date: Sat, 26 Dec 2009 14:33:37 -0800

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

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

  • Prev by Date: Re: Source List Indentation Drawing Issue
  • Next by Date: Compile errors with Objective-C++ properties as STL/TR1 smart pointers
  • Previous by thread: Re: Dynamically update drawRect
  • Next by thread: Re: Dynamically update drawRect
  • Index(es):
    • Date
    • Thread