如何通过点击UIImageView更改ViewController?

时间:2019-08-30 17:09:33

标签: swift uiimageview click viewcontroller tap

我创建了一个CollectionView。该视图有一个userProfileImageView,当我单击此用户配置文件图像时,我想将视图控制器更改为ProfilePage。尝试一些代码,但是现在和推送视图控制器都不起作用。你能帮我吗?

 lazy var userProfileImageView: UIImageView = {

    let useriv = UIImageView()
    useriv.contentMode = .scaleAspectFill
    useriv.clipsToBounds = true
    useriv.layer.cornerRadius = 40 / 2
    useriv.isUserInteractionEnabled = true
    useriv.addGestureRecognizer(UITapGestureRecognizer(target: self, action: #selector(userImageTap)))
    return useriv

}()

@objc func userImageTap() {

    print("useriv clicked")
    let profilePage = ProfilePage(collectionViewLayout: UICollectionViewFlowLayout())



}

0 个答案:

没有答案