我已经尝试过了,但对我没有用:
func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
let cell = collectionView.cellForItem(at: indexPath)
cell?.layer.borderColor = UIColor.gray.cgColor
cell?.layer.borderWidth = 0.5
print("swift")
let storyboard = UIStoryboard(name: "Main", bundle: nil)
let viewController = storyboard.instantiateViewController(withIdentifier: "Action") as! UIViewController
self.navigationController?.pushViewController(viewController, animated: true)
}