IBInspectable崩溃的xcode故事板

时间:2018-12-10 16:20:13

标签: ios xcode-storyboard xcode9.2 ibdesignable ibinspectable

我有一个IBDesignable可可触摸类,可以为我的应用程序上的某些按钮添加cornerRadius,borderWidth和borderColor。

这是课程:

import UIKit

@IBDesignable
class RoundButton: UIButton {


    @IBInspectable var cornerRadius: CGFloat = 0 {
        didSet{
            self.layer.cornerRadius = cornerRadius
        }
    }

    @IBInspectable var borderWidth: CGFloat = 0 {
        didSet{
            self.layer.borderWidth = borderWidth
        }
    }

    @IBInspectable var borderColor: UIColor = UIColor.clear {
        didSet{
            self.layer.borderColor = borderColor.cgColor
        }
    }


}

每当我将此类分配给情节提要检查器中的按钮,并更改被检查对象xcode中的值时,它就会完全无响应。因此,我必须强制退出并从按钮中删除该类。

崩溃报告日志显示以下内容:

Application Specific Information:
ProductBuildVersion: 9C40b
ASSERTION FAILURE in /Library/Caches/com.apple.xbs/Sources/IDEInterfaceBuilder/IDEInterfaceBuilder-13771/InterfaceBuilderKit/IssueProvider/IBIssueProvider.m:72
Details:  castedInstance should be an instance inheriting from IBDocument, but it is IDEPegasusSourceEditor.SourceCodeDocument
Object:   <IBIssueProvider: 0x7fb3e855e260>
Method:   -updatedIssuesForDocument:
Thread:   <NSThread: 0x7fb3e2514cd0>{number = 1, name = main}
Hints:    

0 个答案:

没有答案