Change the app's whole style. Like night version. Without objc runtime and method swizzling.
- Xcode 8.0+
- iOS 8.0+
github DDSkin
pod 'DDSkin'
Property set by String
key.
If you are using IB or StoryBoard,it's easy to config.
Code is also simple.
[self.view setBackgroundColorSkinKey:@"red"];
self.view.backgroundColorSkinKey = @"red";
Default is DDSkinDefaultStorageParser
, and you can make your storage parser。
Default is plist, support extend and super.
Images are lazy load。
#pragma mark - OC API
- (void)setCustomFontSkinKey:(NSString *)key {
if (_customFontSkinKey != key) {
_customFontSkinKey = key;
DDSkinHandler *handler = [DDSkinHandler<typeof(self)> handlerWithTargetKey:DDSelStr(customFontSkinKey) storageKey:key block:^(DDSkinHandler * _Nonnull handler, id<DDSkinStorageProtocol> _Nonnull skinStorage, NSObject * _Nonnull target) {
// do some configuration...
}];
[DDSkinManager registerTarget:self handler:handler apply:YES];
}
else {
[DDSkinManager unregisterTarget:self key:DDSelStr(customFontSkinKey)];
}
}
#pragma mark - C API
- (void)setCustomColorSkinKey:(NSString *)key {
if (_customColorSkinKey != key) {
_customColorSkinKey = key;
DDSkinHandler *handler = [DDSkinHandler<typeof(self)> handlerWithTargetKey:DDSelStr(customColorSkinKey) storageKey:key block:^(DDSkinHandler * _Nonnull handler, id<DDSkinStorageProtocol> _Nonnull skinStorage, NSObject * _Nonnull target) {
// do some configuration...
}];
DDSkinRegisterTargetHandler(self, handler, YES);
}
else {
DDSkinUnregisterTargetHandler(self, key);
}
}