File tree 2 files changed +24
-2
lines changed
components/OverlayWindow/src
2 files changed +24
-2
lines changed Original file line number Diff line number Diff line change 34
34
*/
35
35
- (void )activateOverlay : (UIView *)overlay withLevel : (UIWindowLevel)level ;
36
36
37
+ /* *
38
+ Notifies the window that the given overlay view should be shown at the bottom of the given level.
39
+ This overlay will get added underneath all other overlays with the given UIWindowLevel.
40
+
41
+ Overlay owners must call this method to ensure that the overlay is actually displayed over the
42
+ window's primary content.
43
+
44
+ @param overlay The overlay being displayed.
45
+ @param level The UIWindowLevel to display the overlay on.
46
+ */
47
+ - (void )activateOverlay : (UIView *)overlay atBottomOfLevel : (UIWindowLevel)level ;
48
+
37
49
/* *
38
50
Notifies the window that the given overlay is no longer active.
39
51
Original file line number Diff line number Diff line change @@ -148,7 +148,17 @@ - (void)noteOverlayRemoved:(UIView *)overlay {
148
148
[self updateOverlayHiddenState ];
149
149
}
150
150
151
+ - (void )activateOverlay : (UIView *)overlay atBottomOfLevel : (UIWindowLevel)level {
152
+ [self activateOverlay: overlay withLevel: level bottomOfLevel: YES ];
153
+ }
154
+
151
155
- (void )activateOverlay : (UIView *)overlay withLevel : (UIWindowLevel)level {
156
+ [self activateOverlay: overlay withLevel: level bottomOfLevel: NO ];
157
+ }
158
+
159
+ - (void )activateOverlay : (UIView *)overlay
160
+ withLevel : (UIWindowLevel)level
161
+ bottomOfLevel : (BOOL )bottomOfLevel {
152
162
if (!overlay) {
153
163
return ;
154
164
}
@@ -163,10 +173,10 @@ - (void)activateOverlay:(UIView *)overlay withLevel:(UIWindowLevel)level {
163
173
__block NSUInteger insertionIndex = self.overlays .count ;
164
174
165
175
// Because @c self.overlays is already sorted by level, we can pick the first index which has a
166
- // level larger than @c level.
176
+ // level larger than / equal to @c level.
167
177
[self .overlays enumerateObjectsUsingBlock: ^(UIView *existing, NSUInteger idx, BOOL *stop) {
168
178
UIWindowLevel existingLevel = [self windowLevelForOverlay: existing];
169
- if (level < existingLevel) {
179
+ if ((bottomOfLevel && level == existingLevel) || (level < existingLevel) ) {
170
180
insertionIndex = idx;
171
181
*stop = YES ;
172
182
}
You can’t perform that action at this time.
0 commit comments