在 aUICollectionView中,我正在显示图像并单击它在 ViewController 中打开的图像。工作正常。
但是,当图像在新的 viewController 中打开时,我想将图像向右/向左滑动。
要滑动图像,我尝试CollectionView在单元格中DetailViewController添加和添加UIImageView。
//on clicking the image from main view controller
func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
let vc = storyboard?.instantiateViewController(withIdentifier: "DetailViewController") as? DetailViewController
vc?.name = imgArr[indexPath.row]
self.navigationController?.pushViewController(vc!, animated: true)
}
错误是:
“非法配置:DetailViewController 到 UIImageView 的 img outlet 无效。Outlets 无法连接重复内容。”