• 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: Custom view - newbie stumped
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Custom view - newbie stumped


  • Subject: Re: Custom view - newbie stumped
  • From: Ondra Cada <email@hidden>
  • Date: Mon, 24 Apr 2006 17:57:58 +0200

Kenny,

On Apr 24, 2006, at 5:45 PM, Kenny Millar wrote:

I added an Action to TLView, called 'addTrack'

Note please that although this would work, it is a pretty bad OO design, for you mix controller and view. For just a test it is all right; for real code the controller (which interprets the action) should be separated from the view (


I placed a button on the window and connected it to the 'addTrack' action.
I placed a Custom View on the window and set it's custom class to be 'TLView'

This order of actions is highly suspicious: what you connected the action to *before* adding the view (and setting it to be a TLView)?


Could it be possible you have "instantiated" TLView first, and connected the action to that instance (the blue box in the main NIB window, not the "Custom View" in the GUI window)?

That would explain the behaviour:

But here's the problem, although that line of code gets called, the view doesn't re-draw!?!
If I re-size the window, then as I'd expect, drawRect gets called again and again, but never from my 'addTrack' method.
(I have NSLog(...) statements so I can see what's getting called when).

If my suspicion is right, there are *two* TLView instances in your NIB: the former is not part of any window, but is a target of your action. The latter is in the window, but does not receive any action. Thus, the latter is redrawn whenever the window resizes, but (naturally) does nothing when the button is pressed. The latter is invalidated properly, but, since it is not part of any window, it gets never redrawn.
---
Ondra Čada
OCSoftware: email@hidden http://www.ocs.cz
private email@hidden http://www.ocs.cz/oc



_______________________________________________ Do not post admin requests to the list. They will be ignored. Cocoa-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
  • Follow-Ups:
    • RE: Custom view - newbie stumped
      • From: "Kenny Millar" <email@hidden>
References: 
 >Custom view - newbie stumped (From: Kenny Millar <email@hidden>)

  • Prev by Date: Re: Animated split view collapsing
  • Next by Date: Re: Custom view - newbie stumped
  • Previous by thread: Custom view - newbie stumped
  • Next by thread: RE: Custom view - newbie stumped
  • Index(es):
    • Date
    • Thread