SegmentedViewController: Prevent retain cycles.

This commit is contained in:
SBiOSoftWhare
2021-10-29 10:47:00 +02:00
parent 072ccd1737
commit ce483167d3

View File

@@ -50,7 +50,7 @@
NSLayoutConstraint *leftMarkerViewConstraint;
// Observe kThemeServiceDidChangeThemeNotification to handle user interface theme change.
id kThemeServiceDidChangeThemeNotificationObserver;
__weak id kThemeServiceDidChangeThemeNotificationObserver;
}
@end
@@ -183,9 +183,13 @@
[self createSegmentedViews];
MXWeakify(self);
// Observe user interface theme change.
kThemeServiceDidChangeThemeNotificationObserver = [[NSNotificationCenter defaultCenter] addObserverForName:kThemeServiceDidChangeThemeNotification object:nil queue:[NSOperationQueue mainQueue] usingBlock:^(NSNotification *notif) {
MXStrongifyAndReturnIfNil(self);
[self userInterfaceThemeDidChange];
}];