IKImageView vs sibling views as part of a window's contentView hierarchy
IKImageView vs sibling views as part of a window's contentView hierarchy
- Subject: IKImageView vs sibling views as part of a window's contentView hierarchy
- From: email@hidden
- Date: Tue, 02 Nov 2010 20:46:22 +0900
(my first post to the list in about 8 years!)
i have a trivial subclass of IKImageView (which just overrides some NSView methods like acceptsFirstMouse:, etc.). an instance of this CustomImageView is set as the first subview of my application's window. all well and good so far ...
previously, i had been using an NSImageView for this purpose, but i wanted to switch to using IKImageView to get some of the builtin functionality of the newer class. my initial experimentation has proven successful, with the following exception:
in the program, the user can invoke a command which displays a "control overlay" over the image in the window. this ControlOverlayView is another custom NSView subclass which uses bezier paths to draw stuff in its drawRect: method. when the user invokes the command, the ControlOverlayView is created if it does not yet exist and added to the window's contentView as a subview on top of (in a z-order sense) the image view.
when i was using an NSImageView to hold the image, everything was perfectly fine. now, however, i have noticed that for some weird reason, if i use my CustomImageView (again, this is a trivial subclass of IKImageView), the ControlOverlayView does not show up at all. what's really weird are the following:
1) the ControlOverlayView is properly added as a subview of the window's contentView
2) i know this to be the case both because i can see it programatically by listing out the contentView's subviews ...
3) ... but more importantly because the ControlOverlayView is responding to mouse events as expected ...
so it's there, and doing its stuff, just invisible. the view's drawRect: method is being called, but nothing is being drawn. in all other cases (removing the IKImageView, ControlOverlayView's use in a different part of the program, etc.), the view draws properly.
is there some weird thing about IKImageView which prevents other views from drawing "above" it? note again that the view i've placed above the IKImageView functions properly in all respects other than the fact that it seems to be rendered invisible.
code snippets available on request ...
thanks in advance,
-jf
_______________________________________________
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