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