尝试使用摇动事件更改UICollectionViewCell中的UILabel。据我所知,您似乎无法检测到一个单元内的运动事件。仅视图控制器。
到目前为止,这是我在ViewController中拥有的东西,它是许多CollectionView单元的委托:
override func motionEnded(_ motion: UIEvent.EventSubtype, with event: UIEvent?) {
// Get the indexPath by visible card
var visibleCurrentCellIndexPath: IndexPath? {
for cell in self.collectionView.visibleCells {
let indexPath = self.collectionView.indexPath(for: cell)
return indexPath
}
return nil
}
print("shake & bake on card #\(String(describing: visibleCurrentCellIndexPath))")
}
我可以获取可见单元格的indexPath,但我不知道从此处如何更改indexPath(可见单元格)处单元格的UILabel
{{0} }。
答案 0 :(得分:-1)
var paramList = new Dictionary<string, object>();
paramList.Add("behavior", "allow");
paramList.Add("downloadPath", GlobalConfig.DownloadsDirectoryPath);
driver.ExecuteChromeCommand("Page.setDownloadBehavior", paramList);