我正在尝试为 UITableView 的尺寸变化设置动画。以下代码在 beta 4 中有效:
UIView.animateWithDuration(0.1, animations: {
tableView.frame = CGRectMake(tableView.frame.origin.x, 0 - self.calcTopOffsetToCell(indexPath), tableView.frame.size.width, tableView.frame.size.height + 190)
}, completion: { (finished: Bool) in
self.selectedIndex = indexPath
cell.amountTextfield.becomeFirstResponder()
})
在 beta 5 中,我收到错误消息“调用中参数‘delay’缺少参数”
如果我更改函数以指定延迟:
UIView.animateWithDuration(0.5, delay: Double(0), options: .CurveLinear, animations: {
tableView.frame = CGRectMake(tableView.frame.origin.x, 0 - self.calcTopOffsetToCell(indexPath), tableView.frame.size.width, tableView.frame.size.height + 190)
}, completion: {
(finished: Bool) in
self.selectedIndex = indexPath
cell.amountTextfield.becomeFirstResponder()
});
我收到错误“调用中的额外参数‘延迟’”
不确定是我做错了什么还是这是一个错误。有什么想法吗?
即使我使用了最基本的语法:
UIView.animateWithDuration(0.5, animations: {
tableView.frame = CGRectMake(tableView.frame.origin.x, 0 - self.calcTopOffsetToCell(indexPath), tableView.frame.size.width, tableView.frame.size.height + 190)
})
我收到“调用中缺少参数‘delay’的参数”错误
最佳答案
似乎错误实际上与 calcTopOffsetToCell() 不返回 CGFloat 和 IDE 错误不正确有关。
关于ios - Xcode 6 Beta 5 中的 UIView.animateWithDuration 更改,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25150556/