Re: [iPhone] Zero opacity causes UIView to go numb
Re: [iPhone] Zero opacity causes UIView to go numb
- Subject: Re: [iPhone] Zero opacity causes UIView to go numb
- From: "Hank Heijink (Mailinglists)" <email@hidden>
- Date: Thu, 23 Jul 2009 20:41:36 -0400
Completely transparent views (opacity 0.0) don't receive touch events
- you're not missing anything there. As you have found, a little
opacity is enough to catch them again. Depending on what's in your
view, you might be able to set the background color to [UIColor
clearColor] to get the same effect. Or, maybe you can replace the view
you're hiding with another (empty) one that has a transparent
background color.
I'm not sure what will work for you without knowing more, but there
are ways to accomplish what you're trying to do.
Good luck,
Hank
On Jul 23, 2009, at 10:49 AM, Sebastian Morsch wrote:
Hi,
I *KNOW* this must be something absolutely stupid I'm missing, but
I'm stuck with this:
I have an UIView that's supposed to display an explanatory overlay
image whenever it's touched. When the user lifts the finger, the
overlay should fade away. To accomplish this I do the following
Inside my OverlayView's init method:
self.layer.contents = (id)[UIImage imageNamed:@"overlay.png"]
CGImage];
self.layer.opacity = 0.0;
and then, inside the touchBegan: and touchEnded: methods I set the
opacity to 1.0 and 0.0 respectively.
Now, this doesn't work at all, the view doesn't receive the
touchBegan: and touchEnded: methods. But everything works fine if I
set the opacity to 0.1 instead of 0.0!! And for instance, when I do
this:
1. set opacity to 0.1 in the init call...
2. set opacity to 1.0 in the touchBegan call...
3. set opacity to 0.0 (!!!) in the touchEnded call...
all subsequent touches are ignored, touchBegan:, touchEnded:, etc.
are never called again.
Any help on this is very very much appreciated!
Thanks, Sebastian
_______________________________________________
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:
@runbox.com
This email sent to email@hidden
_______________________________________________
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