Please do not post the same thing multiple times. The board software automatically flags certain posts as needing moderator attention. This happens the most often for new users. I'm pretty sure this is made clear at the time you attempt to post. Posting the same thing over and over again just makes that many more posts the moderators have to weed through later. This makes us sad. Don't make us sad. If your post/thread doesn't appear, just wait a while. Don't post it again. If it hasn't shown up by the next day, then you can try again. I normally go through posts in the mornings, and try to check a few times throughout the day, but I'm not here 24/7. There will typically be a significant delay before posts are approved. Just be patient.
what's the difference between alpha=0 and hidden=YES?
I want to put a UIView as a subview to the toppest of all the other subviews. And I want to let this UIView be totally transparent and also let this UIView receive some input events such as slipping over its surface. So I set its alpha to Zero. It is totally transparent after that but the strange thing is it can't receive any input events. And if I tap it, the other UIViews below it would receive the tap event. It seems that the UIView whose alpha=0 disappears or hides. If that's true, I wonder that what's the difference between alpha=0 and hidden=YES?!!! How could it be?!! If alpha=0 and hidden=YES are the same, why do we need property hidden?
If anyone could give me an answer to this question or tell me another way to let a UIView be transparent and receive some input events at the same time, I'll appreciate him/her very much.
Also thank the guys who come in to read my question.
BTW, the UIView can receive events when its alpha value equals or more than 0.02. But I can't let it be 0.02 because of some reasons. I want it to be Zero.
I want to put a UIView as a subview to the toppest of all the other subviews. And I want to let this UIView be totally transparent and also let this UIView receive some input events such as slipping over its surface. So I set its alpha to Zero. It is totally transparent after that but the strange thing is it can't receive any input events. And if I tap it, the other UIViews below it would receive the tap event. It seems that the UIView whose alpha=0 disappears or hides. If that's true, I wonder that what's the difference between alpha=0 and hidden=YES?!!! How could it be?!! If alpha=0 and hidden=YES are the same, why do we need property hidden?
If anyone could give me an answer to this question or tell me another way to let a UIView be transparent and receive some input events at the same time, I'll appreciate him/her very much.
Also thank the guys who come in to read my question.
BTW, the UIView can receive events when its alpha value equals or more than 0.02. But I can't let it be 0.02 because of some reasons. I want it to be Zero.
I believe that Cocoa Touch treats and alpha less than .02 as also being hidden, since below that alpha level it's invisible, and Apple's engineers decided that invisible controls should not be clickable.
Using an alpha value requires that the graphics hardware blend each pixel from the object with everything underneath. It's compute-intensive. The hidden flag, on the other hand, is a switch. If you turn it on, the OS knows it doesn't have to draw the object at all.
In order to do what you're trying to do you might have to leave the object's alpha value as 1, but set the alpha value of all of its pixels to zero. (Set it's background color to [UIColor clearColor] and don't give it any contents. That should enable it to receive events, but still be invisible.
Regards,
Duncan C WareTo
Animated GIF created with Face Dancer, available for free in the app store.
Replies
Visit our blog at UK iPhone Developers or <a hr
- Spam
- Abuse
- Troll
0 • Off Topic Insightful Disagree Dislike Like AwesomeI believe that Cocoa Touch treats and alpha less than .02 as also being hidden, since below that alpha level it's invisible, and Apple's engineers decided that invisible controls should not be clickable.
Using an alpha value requires that the graphics hardware blend each pixel from the object with everything underneath. It's compute-intensive. The hidden flag, on the other hand, is a switch. If you turn it on, the OS knows it doesn't have to draw the object at all.
In order to do what you're trying to do you might have to leave the object's alpha value as 1, but set the alpha value of all of its pixels to zero. (Set it's background color to [UIColor clearColor] and don't give it any contents. That should enable it to receive events, but still be invisible.
Duncan C
WareTo
Animated GIF created with Face Dancer, available for free in the app store.
- Spam
- Abuse
- Troll
0 • Off Topic Insightful Disagree Dislike Like Awesome