• 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
SubViews and Events
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

SubViews and Events


  • Subject: SubViews and Events
  • From: Erik Buck <email@hidden>
  • Date: Tue, 15 Aug 2006 19:44:51 -0400

There is generally no problem with programatically creating instances of subclasses of NSView. Are you maybe attempting to initialize an instance without calling the super class's designated initializer, - initWithFrame: ?

When a view is added as a sub-view of another view via the - addSubview: method, the sub view is layered above the super view. The subview receives mouse events before the superview. The subview is automatically in the responder chain as long as its super view is in the responder chain.

http://developer.apple.com/documentation/Cocoa/Conceptual/ CocoaViewsGuide/WorkingWithAViewHierarchy/chapter_4_section_5.html

If you want to change normal subview interaction with the mouse, implement the – hitTest: method. If a view returns nil from - hitTest:, the mouse event will fall through to the super view as if the subview under the mouse was not even there.

My suggestion is that you read up on the view hierarchy and responder chain. There are also many many examples available for you to analyze.
_______________________________________________
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: SubViews and Events
      • From: Jerrod Fowkes <email@hidden>
  • Prev by Date: Re: Unit testing and Xcode integration
  • Next by Date: Re: X-Code: multifile Global find/replace?
  • Previous by thread: Re: SubViews and Events
  • Next by thread: Re: SubViews and Events
  • Index(es):
    • Date
    • Thread