iphone, able to hide a view and touch it?
apparently,
self.hidden = YES;
self.userInteractionEnabled = YES;
hides the view but doesn't recognize touch events.
I开发者_StackOverflow中文版s there a way of hiding a view and touching it?
There is NO way to do this. The solution is to make another UIView, which is empty. The only purpose of this new UIView is to catch the click.
That is the only way to do it.
(You could also perhaps make a large transparent button, depending on your needs.)
The alpha thing is a famous gotchya. If you alpha away a UIView, it becomes unclickable. You will only be able to click it, if you can see it. Hope it helps.
set the backgroundColor to clear works for me. You may also need to set the text color.
view.backgroundColor = UIColor.clear
精彩评论