Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

I'd like to create a UIView 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 UserInteractionEnabled to NO, or is there more to it? Do I need to subclass UIView, or override something, etc.?

like image 787
Luke Avatar asked Dec 28 '25 14:12

Luke


1 Answers

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];
like image 180
dsgriffin Avatar answered Dec 31 '25 04:12

dsgriffin



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!