• 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
Both view and subview receive mouse events?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Both view and subview receive mouse events?


  • Subject: Both view and subview receive mouse events?
  • From: Ivan Kourtev <email@hidden>
  • Date: Wed, 25 Oct 2006 00:18:28 -0400

Hi,

I have a custom view viewA contained within a scrollview. I wanted to add a subview viewB in viewA so I do something this (self is viewA):

viewB = [[MyOverlayView alloc] initWithFrame:[self bounds] view:self];
[self addSubview:viewB];


After I do the above, viewB is created and inserted into viewB (completely overlaying it) but both viewA and viewB receive mouse events? I overrode hitTest and all mouse events to make sure and it is indeed the case. All events come to viewB first, then to viewA which seems to contradict what I expect based on the docs.

However, if I change the code above to insert viewB not in viewA but in the scroll view containing viewA like the following:

    [[self superview] addSubview:viewB];

then everything seems to be working more logically, only the top view viewB receives mouse events.

I assume this is correct behavior but I cannot figure out why?

So why do both viewA and viewB receive mouse events in the first case above?

Cheers,

-- ivan
_______________________________________________
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


  • Prev by Date: Re: CIImage from CGImageRef
  • Next by Date: modalForWindow query
  • Previous by thread: Re: Re: Keys down while dragging
  • Next by thread: modalForWindow query
  • Index(es):
    • Date
    • Thread