lukech lukech - 2 years ago 99
iOS Question

UIView 'falling rain' transparent overlay that can be clicked through?

I'd like to create a

which will animate falling rain, which should be above all other views, at the very front, but transparent, and it shouldn't register taps or interaction at all, so tapping the UI behind it should behave exactly as it does now, before I've implemented it. It'd act as an overlay, and nothing more.

Is this as simple as setting
, or is there more to it? Do I need to subclass
, or override something, etc.?

d.g d.g
Answer Source

Yes, set userInteractionEnabled = NO; No need to subclass UIView. e.g.:

UIView *overlay = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 320, 460)];
overlay.backgroundColor = [UIColor colorWithWhite:0 alpha:.5];
[self.view addSubview:overlay];
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download