有什麼辦法可以結合兩個CGRect? 我想將「y:65.0」添加到現有的CGRect中,似乎無法找到任何方法來完成它。 聽起來像一個簡單的任務給我,但似乎不可能在Xcode中做,因爲CGRect之間不允許使用「+ =」。結合兩個CGRect
編輯:試用offsetBy並使用下面的代碼添加它們。當添加的CGRect的我得到的錯誤信息:No '+' candidates produce the expected contextual result type 'CGRect'
var fromRect:CGRect = self.tableView.rectForRow(at: indexPath)
let addRect = CGRect(x: 0.0, y: 65.0, width: 0.0, height: 0.0)
//fromRect.offsetBy(dx: 0, dy: 65.0)
fromRect = fromRect + addRect
這是什麼意思「結合兩個CGRect」? – user3441734
可能的重複http://stackoverflow.com/questions/30533937/can-you-combine-cgrects-with-each-other-in-swift?但我不確定它是否適用於Swift 3. – Moritz