【发布时间】:2018-04-09 09:57:04
【问题描述】:
无法转换 '(_) -> Void?' 类型的值到预期的参数类型'(() -> Void)?'
[![在此处输入图片描述][1]][1]
[1]:https://i.stack.imgur.com/M1MYV.png`func deselectSelectedCells() { 如果让开始 = startDateIndexPath { var section = start.section var item = start.item + 1
if let cell = collectionView?.cellForItem(at: start) as? AirbnbDatePickerCell {
cell.type.remove([.InBetweenDate, .SelectedStartDate, .SelectedEndDate, .Selected])
cell.configureCell()
collectionView?.deselectItem(at: start, animated: false)
}
if let end = endDateIndexPath {
var indexPathArr = [IndexPath]()
while section < months.count, section <= end.section {
let curIndexPath = IndexPath(item: item, section: section)
if let cell = collectionView?.cellForItem(at: curIndexPath) as? AirbnbDatePickerCell {
cell.type.remove([.InBetweenDate, .SelectedStartDate, .SelectedEndDate, .Selected])
cell.configureCell()
collectionView?.deselectItem(at: curIndexPath, animated: false)
}
if section == end.section && item >= end.item {
// stop iterating beyond end date
break
} else if item >= (collectionView!.numberOfItems(inSection: section) - 1) {
// more than num of days in the month
section += 1
item = 0
} else {
item += 1
}
}
collectionView?.performBatchUpdates({
(s) in
self.collectionView?.reloadItems(at: indexPathArr)
}, completion: nil)
}
}
}`
【问题讨论】:
-
删除
(s) in? -
在可能的情况下粘贴代码而不是使用屏幕截图,这样可以让他人更轻松地尝试测试您的示例,谢谢!
标签: ios swift uicollectionview