我想重新排序我的单元格的uicollection视图。当我尝试时,它有时会起作用(延迟),但有时,我的应用程序崩溃。 我在互联网上到处搜索,但无法找到答案。UICollection视图重新排序单元格崩溃ios swift
func handleLongGesture(panRecognizer: UIPanGestureRecognizer){
let locationPoint: CGPoint! = panRecognizer.locationInView(collectionView)
guard let selectedIndexPath : NSIndexPath = collectionView.indexPathForItemAtPoint(locationPoint) else {
return
}
if panRecognizer.state == .Began{
collectionView.beginInteractiveMovementForItemAtIndexPath(selectedIndexPath)
indexPathSelectedItem = selectedIndexPath
}
else if panRecognizer.state == .Changed{
collectionView.updateInteractiveMovementTargetPosition(locationPoint)
}
else if panRecognizer.state == .Ended{
collectionView.endInteractiveMovement()
}
}
这是我正在尝试上面的代码。我无法找到整个代码中的错误。 我想让你知道,我也尝试使用断点来找出我的应用程序崩溃的地方,我发现有时控制不能在状态“panRecognizer.state == .Ended”下去,我认为这是原因我的应用崩溃了。
哪里是你的symbolicated崩溃日志?哪一行代码导致崩溃? –
你还可以添加你的崩溃日志吗? – Thomas