ios - UITapGestureRecognizer working on UIImageView but not on UILabel -


i have uitableviewcell class named commentstableviewcell among other things includes uiimageview , uilabel.

code i'm using:

let tapgesture = uitapgesturerecognizer(target: self, action: #selector(commentstableviewcell.showuserviewcontroller)) namelabel.userinteractionenabled = true avatarroundimageview.userinteractionenabled = true namelabel.addgesturerecognizer(tapgesture) avatarroundimageview.addgesturerecognizer(tapgesture) 

as can understand have function shows uiviewcontroller whenever uiimageview or uilabel tapped.

what buffles me tapgesture works correctly on uiimageview not on uilabel.

any ideas?

you need different gesture control

let tapgesture = uitapgesturerecognizer(target: self, action: #selector(commentstableviewcell.showuserviewcontroller)) avatarroundimageview.userinteractionenabled = true avatarroundimageview.addgesturerecognizer(tapgesture)  let tapgesture2 = uitapgesturerecognizer(target: self, action: #selector(commentstableviewcell.showuserviewcontroller)) namelabel.userinteractionenabled = true namelabel.addgesturerecognizer(tapgesture2) 

Comments

Popular posts from this blog

php - How to add and update images or image url in Volusion using Volusion API -

Laravel mail error `Swift_TransportException in StreamBuffer.php line 269: Connection could not be established with host smtp.gmail.com [ #0]` -

c# SetCompatibleTextRenderingDefault must be called before the first -