当我点击一个单元我想推这个视图控制器。如何从UIView推视图控制器
这里是我的代码:
func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
let user = filteredUsers[indexPath.item]
print(user.username)
let userProfileController = UserProfileController(collectionViewLayout: UICollectionViewFlowLayout())
}
我想推userProfileController
。
注:这是一个UIView
不是一个视图控制器
你可以从该视图和推视图控制器。 https://stackoverflow.com/a/24590678/6642629 – koropok
你不能从视图推动。 – Pushpendra
考虑为拥有视图的视图控制器创建回调/委托,并从该位置推入下一个视图控制器。 – user3581248