ios - MDC 崩溃并显示 'NSInvalidArgumentException' ,原因 : '-[UIButton applyOutlinedThemeWithScheme:]: unrecognized selector sent to instance

标签 ios swift material-design material-components material-components-ios

我正在尝试设置这样的按钮属性, 当我添加此代码时,它崩溃了,甚至没有显示我在 main.storyboard 中的按钮。

 let containerScheme = MDCContainerScheme()
        cancelButton.applyOutlinedTheme(withScheme: containerScheme)

console

最佳答案

我遇到了同样的问题。但我是通过代码构建 UI 的。

import MaterialComponents.MaterialButtons
import MaterialComponents.MaterialButtons_Theming

let button = MDCButton()
button.applyTextTheme(withScheme: MDCContainerScheme())

以下内容对我有帮助。我刚刚调用了选项产品 -> 清理构建文件夹。 之后程序异常终止的现象消失了。

关于ios - MDC 崩溃并显示 'NSInvalidArgumentException' ,原因 : '-[UIButton applyOutlinedThemeWithScheme:]: unrecognized selector sent to instance,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56519071/

相关文章:

ios - navigator.app 未定义

ios - CGImage 到 UIImage 不起作用

swift - 在 Swift 中使用 Timer() 的命令行工具

ios - 从 NSPredicate 访问实体时的 EXC_BAD_ACCESS

android - 增加 SwitchCompat 的轨道长度

c# - 如何从通知中心更新/删除通知?

iphone - UITableViewCell 中的 VoiceOver 用户交互

ios - 在行选择上设置 TableViewCell 标签颜色 Swift 3

android - Android 的 Material Components 中新的 ExtendedFloatingActionButton 的收缩和扩展功能不起作用

android - 如何在 Eclipse 中添加 Android 支持 v7 库?