MAThemeKit 为 iOS 开发者提供了一种功能,可以使用一行代码在其整个应用程序中创建一致的颜色主题,从而不再需要手动操作每个 UI 组件的数十个 UIAppearance 协议。
将 MAThemeKit.h/m 文件放入您的项目中,在 AppDelegate.m 文件中导入头文件,并在 application:didFinishLaunchingWithOptions: 方法中告诉 MAThemeKit 您的首选主色和辅色,应用程序导航/标签栏的字体以及是否希望状态栏为浅色模式。(注意 - 您仍然需要手动向您的 Info.plist 中添加 'View controller-based status bar appearance' 键并将其设置为 NO,以便将状态栏设置为浅色内容。)
一串简单的代码,您的整个应用程序将会使用新漂亮的主题!
[MAThemeKit setupThemeWithPrimaryColor:[MAThemeKit colorWithR:0 G:184 B:156] secondaryColor:[UIColor whiteColor] fontName:@"HelveticaNeue-Light" lightStatusBar:YES];
MAThemeKit 提供了两种便利方法来从 RGB 值或十六进制字符串创建 UIColor 对象,以便快速轻松地创建 Photoshop 颜色选择器中可能获取的颜色信息。
// Use the rgb values BEFORE they are divided by 255.0, like you would see in photoshop's color picker
UIColor *colorWithRGB = [MAThemeKit colorWithR:0 G:184 B:156]
// Use the normal hex string representing the color
UIColor *colorWithHex = [MAThemeKit colorWithHexString:@"00b89c"];
欢迎提问、评论、问题和拉取请求!!
本项目根据 MIT 许可证提供。有关详细信息,请参阅 LICENSE.txt。