在Objective-C我的动画位将是这个样子:animateWithDuration:动画:完成:在斯威夫特
[UIView animateWithDuration:0.5 animations:^{
[[[_storedCells lastObject] topLayerView] setFrame:CGRectMake(0, 0, swipeableCell.bounds.size.width, swipeableCell.bounds.size.height)];
} completion:^(BOOL finished) {
[_storedCells removeLastObject];
}];
如果我翻译成雨燕应该是这个样子:
UIView.animateWithDuration(0.5, animations: {
self.storedCells[1].topLayerView.frame = CGRectMake(0, 0, cell.bounds.size.width, cell.bounds.size.height)
}, completion: { (finished: Bool) in
//self.storedCells.removeAtIndex(1)
})
它抱怨注释行。我收到的错误是:Could not find an overload for 'animateWithDuration' that accepts the supplied arguments
我知道完成闭包需要一个布尔值并返回一个void,但是我应该能够写出一些与bool无关的东西....对吧?
任何帮助表示赞赏。
编辑:这里是我声明我正在使用的功能数组:
var storedCells = SwipeableCell[]()
数组,需要SwipeableCell对象。
你能告诉self.storedCells'的'的声明和分配。 –
@ 0x7fffffff我更新了我的回答 –