小编wyl*_*cat的帖子

ios swift3,错误说框架没有成员大小

我不知道框架到底是什么,但我可以建造

override public var intrinsicContentSize: CGSize {
    let buttonSize = Int(frame.size.height)
    let width = (buttonSize * starCount) + (spacing * (starCount-1))
    return CGSize(width: width, height: buttonSize)
}
Run Code Online (Sandbox Code Playgroud)

但我不能建立

class RatingControl: UIView {

// MARK: Properties 

let spacing = 5
let starCount = 5
let buttonSize = Int(frame.size.height)

.....
}
Run Code Online (Sandbox Code Playgroud)

此代码和错误表示“类型'(UIView)->(CGRect)-> CGRect'的值没有成员'大小'”

为什么会发生这种情况?

提前致谢。

ios swift swift3

1
推荐指数
1
解决办法
3939
查看次数

标签 统计

ios ×1

swift ×1

swift3 ×1