Value of type '(CGRect) -> CGRect' has no member:是由於你變量類型定義錯了

Value of type '(CGRect) -> CGRect' has no member:是由於你變量類型定義錯了

Value of type '(CGRect) -> CGRect' has no member 'maxY'
Value of type '(CGRect) -> CGRect' has no member 'maxX'
Value of type '(CGRect) -> CGRect' has no member 'width'
Value of type '(CGRect) -> CGRect' has no member 'height'
Value of type '(CGRect) -> CGRect' has no member 'size'

是由於你定義的某個變量屬性不對,多半應該是 CGFloat,而你沒有規定變量類型,系統默認識別成了 Int 或者 Double 類型swift

let frameWidth = 300 // 識別爲 Int

// 改成
let frameWidth: CGFloat = 300
相關文章
相關標籤/搜索