File tree 1 file changed +18
-0
lines changed
1 file changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -28,6 +28,14 @@ @implementation AIRMapMarker {
28
28
NSInteger _zIndexBeforeOpen;
29
29
}
30
30
31
+ - (instancetype )initWithFrame : (CGRect )frame {
32
+ self = [super initWithFrame: frame];
33
+ if (self) {
34
+ [self .layer addObserver: self forKeyPath: @" zPosition" options: NSKeyValueObservingOptionNew context: nil ];
35
+ }
36
+ return self;
37
+ }
38
+
31
39
- (void )reactSetFrame : (CGRect )frame
32
40
{
33
41
// Make sure we use the image size when available
@@ -312,4 +320,14 @@ - (void)setZIndex:(NSInteger)zIndex
312
320
self.layer .zPosition = zIndex;
313
321
}
314
322
323
+ - (void )dealloc {
324
+ [self .layer removeObserver: self forKeyPath: @" zPosition" ];
325
+ }
326
+
327
+ - (void )observeValueForKeyPath : (NSString *)keyPath ofObject : (id )object change : (NSDictionary <NSKeyValueChangeKey,id> *)change context : (void *)context {
328
+ if ([keyPath isEqualToString: @" zPosition" ]) {
329
+ self.layer .zPosition = _zIndex;
330
+ }
331
+ }
332
+
315
333
@end
You can’t perform that action at this time.
0 commit comments