對於新手的問題感到抱歉。似乎無法在Swift中使用CGRectIntegral和CGInsect函數
但只是要求標題暗示,我似乎無法使用這些函數在迅速3 ..我已經嘗試導入CoreGraphics庫,但沒有vail。
任何人都知道爲什麼?
在此先感謝。
對於新手的問題感到抱歉。似乎無法在Swift中使用CGRectIntegral和CGInsect函數
但只是要求標題暗示,我似乎無法使用這些函數在迅速3 ..我已經嘗試導入CoreGraphics庫,但沒有vail。
任何人都知道爲什麼?
在此先感謝。
其工作正常,但語法變化
let frame = CGRect.zero
let x = frame.integral
frame.insetBy(dx: 0, dy: 0)
謝謝你的回答。哦,好吧..我現在得到它..謝謝一堆! – user3608914
我還沒有檢查,但我想你可以像這樣使用 attributes.frame = attributes.frame.integral –
其實你並不需要導入CoreGraphics中。
在夫特3 Objective-C的功能
CGRect CGRectIntegral(CGRect rect)
已成爲
var integral: CGRect { get }
和
CGRect CGRectInset(CGRect rect, CGFloat dx, CGFloat dy);
已成爲
func insetBy(dx: CGFloat, dy: CGFloat) -> CGRect
兩個API已對CGRect
實例調用例如
let newFrame = view.frame.insetBy(dx: 10.0, dy:10.0)
一個提示,找出自己
非常感謝! – user3608914
進口CoreGraphics在
let rect = CGRect() let rectIntegral = rect.integral
謝謝:)
導入CoreGraphics後,它工作正常...我檢查了xcode 8,swift 3 .. –