Skip to content

Change the app's whole style. Like night version. Without objc runtime.

License

Notifications You must be signed in to change notification settings

djs66256/DDSkin

Repository files navigation

DDSkin

Change the app's whole style. Like night version. Without objc runtime and method swizzling.

中文文档

Requirements

  • Xcode 8.0+
  • iOS 8.0+

Installation

github DDSkin
pod 'DDSkin'

Guide

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";

Settings file

Default is DDSkinDefaultStorageParser, and you can make your storage parser。

Default is plist, support extend and super.

Images are lazy load。

Extension

#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);
    }
}

More Info

做更好的换肤框架

About

Change the app's whole style. Like night version. Without objc runtime.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published