Comments (10)
你是不是对源码做了修改?做了哪些修改?
from swifttheme.
没有,直接下载后编译就失败了
from swifttheme.
我这边没有问题,你可以试下重新下载编译,如果还有问题最好提供具体的错误日志
from swifttheme.
@marychenyuan 确认你的xcode 版本是否为7.3,老版本的xcode 是更早的swift 语法
from swifttheme.
Swift2.2版本之前声明选择器的方法是 Selector("someMethod")
或者 "someMethod"
,在Swift2.2之后语法改为了 #selector(someMethod)
例如你报错那行的代码是这样的:
NSNotificationCenter.defaultCenter().addObserver(self, selector: #selector(_updateTheme), name: ThemeUpdateNotification, object: nil)
如果你暂时不想升级Xcode,为了编译通过,你可以暂时将此处修改为旧的写法:
NSNotificationCenter.defaultCenter().addObserver(self, selector: "_updateTheme", name: ThemeUpdateNotification, object: nil)
😄
注:类似的语法在Demo中有三处,同样的方法修改即可
from swifttheme.
谢谢你们的耐心指导! 确实是xcode未升级到7.3版本的问题。 升级后就正常运行了!
另外,是否能提供一份使用objective-c来调用这个框架的代码呢? 我现在急需使用换肤功能,觉得这套框架很适合放在我的项目中,但由于不熟悉swift所以有点力不从心。。。。
如果有示例的话我会更容易使用它!
from swifttheme.
把SwiftTheme 源代码拷贝到你的项目中,在.m 文件中引入 import "xxx-Swift.h",这里的xxx 一般是你的target 名称,具体的看你项目的Build Settings 中的“Objective-C Generated Interface Header Name” 配置。
SwiftTheme 的OC 接口一般用法如下:
lbl.theme_backgroundColor = [ThemeColorPicker pickerWithColors:@[@"#FAF9F9", @"#E2E2E2"]];
from swifttheme.
好的,非常感谢~
from swifttheme.
@marychenyuan 刚刚增加了Objective-C的Demo
from swifttheme.
好!麻烦了~!
from swifttheme.
Related Issues (20)
- plist文件中,主题颜色怎么设置alpha HOT 1
- The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 14.4.99. HOT 1
- UITabBarItem theme_setTitleTextAttributes crash HOT 3
- tabBar.theme_barTintColor fades tabBar border HOT 6
- swift 5,创建一个新控制器,导航栏右边的文字颜色没改变,还有tabbar会跳动,什么原因呢?
- SwiftUI support HOT 1
- oc 如何设置渐变 theme_colors HOT 2
- navigation controller and tabbar color is not correct on iOS 15 HOT 5
- 如何在OC中通过theme获取Color呢 HOT 9
- change theme with circular animation HOT 3
- theme_border color HOT 2
- Error compilation via Carthage HOT 2
- Issues with UILabel and UIView with shadow (Swift)
- 如何设置颜色的透明度? HOT 1
- Questions regarding @objc usage + Multiplatform Swift support. HOT 3
- 当key path 找不到对应的value的时候,picker应该弄个默认值输入 HOT 1
- 在同一个项目中,可以拥有2个以上的 ThemeManager 吗?
- 如何获取ThemePicker对应的值?ThemePicker.value() 为Optional<Any> HOT 3
- 想给label设置富文本的主题,如何配置plist
- 透明颜色设置还是有问题 HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from swifttheme.