forked from aydenp/Ultrasound
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ABVolumeHUDWindow.m
50 lines (42 loc) · 1.35 KB
/
ABVolumeHUDWindow.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
//
// ABVolumeHUDWindow.m
// Ultrasound
//
// Created by Ayden Panhuyzen on 8/27/18.
// Copyright © 2018 Ayden Panhuyzen. All rights reserved.
//
#import "Headers.h"
#import "ABVolumeHUDWindow.h"
#import "ABVolumeHUDContainerViewController.h"
@implementation ABVolumeHUDWindow
- (id)init {
self = [super init];
if (self) {
self.backgroundColor = nil;
self.hidden = NO;
self.windowLevel = 1100; // just above banners
}
return self;
}
-(BOOL)pointInside:(CGPoint)point withEvent:(UIEvent *)event {
if (_darkScreenImitationAlpha > 0) {
[[NSNotificationCenter defaultCenter] postNotificationName:kOLEDWindowTappedNotification object:nil];
return NO;
}
for (UIView *view in self.subviews) {
if ([view.nextResponder isKindOfClass:[ABVolumeHUDContainerViewController class]] && [view pointInside:[self convertPoint:point toView:view] withEvent:event]) return YES;
}
return NO;
}
- (BOOL)_shouldCreateContextAsSecure {
return YES;
}
- (void)setDarkScreenImitationAlpha:(CGFloat)darkScreenImitationAlpha {
_darkScreenImitationAlpha = darkScreenImitationAlpha;
self.backgroundColor = [UIColor colorWithWhite:0 alpha:darkScreenImitationAlpha];
}
// Don't control the device's auto-rotation orientation (possible fix for #2)
- (BOOL)_shouldControlAutorotation {
return NO;
}
@end