[macos] Avoid nilling out style URL on load
-awakeFromNib nils out the styleURL property to ensure a style is always present on load. However, if the style URL is specified in the Style URL inspectable, it is set somewhere between -initWithCoder: and -awakeFromNib; nilling out the styleURL property in -awakeFromNib thus resets the style to the default. This change guards against nilling out a non-nil style URL, ensuring that -setStyleURL: is called once and only once on launch.
This commit is contained in:
committed by
Minh Nguyễn
parent
e38216d254
commit
344cd173ea
@@ -231,7 +231,11 @@ public:
|
||||
- (void)awakeFromNib {
|
||||
[super awakeFromNib];
|
||||
|
||||
self.styleURL = nil;
|
||||
// If the Style URL inspectable was not set, make sure to go through
|
||||
// -setStyleURL: to load the default style.
|
||||
if (_mbglMap->getStyleURL().empty()) {
|
||||
self.styleURL = nil;
|
||||
}
|
||||
}
|
||||
|
||||
+ (NSArray *)restorableStateKeyPaths {
|
||||
|
||||
Reference in New Issue
Block a user