StyleKit 可配置 UI Style 工具库 项目简介
StyleKit 是能让你使用一个简单的 JSON 文件美化你的应用的微框架。它如何工作?按如下格式创建一个 JSON 文件:{
"UILabel": {
"font": "HelveticaNeue-Bold:30.0",
"backgroundColor": "#000FFF"
},
"StyleKitDemo.SKView": {
"StyleKitDemo.SKLabel": {
"font": "HelveticaNeue-Bold:20.0",
"backgroundColor": "#FFF000",
"color": "#fff"
},
"StyleKitDemo.SKButton": {
"font": "HelveticaNeue-Light:20.0",
"titleColor:normal": "#FFFFFF",
"titleColor:highlighted": "#000000"
}
},
"StyleKitDemo.SKNavigationBar": {
"titleTextAttributes": {
"NSColor": "#000FFF",
"NSFont": "HelveticaNeue-Bold:30.0"
}
},
"StyleKitDemo.SKTextField": {
"font": "HelveticaNeue-Light:20.0",
"textColor": "#000FFF"
}
}加载 JSON 文件func application(application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
if let styleFile = NSBundle.mainBundle().URLForResource("style", withExtension: "json") {
StyleKit(fileUrl: styleFile)?.apply()
}
return true
}安装:Carthagegithub "146BC/StyleKit" ~> 0.3CocoaPodsAdd the 146BC Sourcesource 'https://github.com/146BC/Specs.git'
source 'https://github.com/CocoaPods/Specs.git'pod 'StyleKit', '~> 0.3
"UILabel": {
"font": "HelveticaNeue-Bold:30.0",
"backgroundColor": "#000FFF"
},
"StyleKitDemo.SKView": {
"StyleKitDemo.SKLabel": {
"font": "HelveticaNeue-Bold:20.0",
"backgroundColor": "#FFF000",
"color": "#fff"
},
"StyleKitDemo.SKButton": {
"font": "HelveticaNeue-Light:20.0",
"titleColor:normal": "#FFFFFF",
"titleColor:highlighted": "#000000"
}
},
"StyleKitDemo.SKNavigationBar": {
"titleTextAttributes": {
"NSColor": "#000FFF",
"NSFont": "HelveticaNeue-Bold:30.0"
}
},
"StyleKitDemo.SKTextField": {
"font": "HelveticaNeue-Light:20.0",
"textColor": "#000FFF"
}
}加载 JSON 文件func application(application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
if let styleFile = NSBundle.mainBundle().URLForResource("style", withExtension: "json") {
StyleKit(fileUrl: styleFile)?.apply()
}
return true
}安装:Carthagegithub "146BC/StyleKit" ~> 0.3CocoaPodsAdd the 146BC Sourcesource 'https://github.com/146BC/Specs.git'
source 'https://github.com/CocoaPods/Specs.git'pod 'StyleKit', '~> 0.3