In my application, I want to select UIView programmatically.
How can I select UIView programmatically?
If(UIView is selected programmatically || UIView is tapped){
invoke tapGesture Action
}
Is it possible?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
UIView itself doesn’t support selection, although some subclasses do. For example, UITableViewCell has a
selectedproperty that modifies how the cell draws itself.If you want to mimic what happens when a user taps a view, you’ll do two things:
Provide the same feedback that the user would see if she tapped that view. This might mean redrawing the view, performing an animation,playing a sound, or some combination of those.
Perform the same action that would happen if the user tapped the view.
So, if the view is a button, you might set its
highlightedstate to YES, wait maybe 0.2 seconds, and then set it back to its previous state. Next, invoke the button’s action on the button’s target.