---
title: "Detecting events on tap of UIButton in iOS"  
description: "Detecting events on tap of UIButton in iOS"  
author: "Anonymous User"  
published: 2015-11-29  
updated: 2015-11-30  
canonical: https://www.mindstick.com/forum/33656/detecting-events-on-tap-of-uibutton-in-ios  
category: "iphone"  
tags: ["iphone", "ios", "objective c"]  
reading_time: 1 minute  

---

# Detecting events on tap of UIButton in iOS

In my [iPhone application](https://www.mindstick.com/forum/23139/can-i-embed-a-custom-font-in-an-iphone-application) on which I am working I want to [handle](https://www.mindstick.com/articles/311004/suede-skillet-handle-cover) an [event](https://www.mindstick.com/articles/167719/marquee-hire-benefits-of-event-lighting-hire-london) occurs when UIButton touch is ended.\
I know that **UIControl** has some [events](https://www.mindstick.com/blog/102/events-in-c-sharp) implementing touches (**UIControlEventTouchDown**, **UIControlEventTouchCancel**, etc.).\
But my [problem](https://yourviews.mindstick.com/view/81399/tackling-the-problem-of-unemployment-during-corona-pandemic) is I am unable to catch any of them [except](https://www.mindstick.com/blog/144/union-intersection-and-except-operator-in-sql-server) *UIControlEventTouchDown* and *UIControlEventTouchUpInside*.

My [button](https://www.mindstick.com/articles/63/how-to-add-button-in-datagridview-in-csharp-dot-net) is a subview of another UIView. That UIView has userInteractionEnabled [property](https://www.mindstick.com/blog/205/property-notification-in-c-sharp) set to YES.\
I [am unable](https://answers.mindstick.com/qa/95314/how-do-i-access-a-group-link-in-telegram-if-i-am-unable-to-access-the-link) to understand that what's wrong I am doing?

## Replies

### Reply by Tarun Kumar

There are many ways to identify button event here I am providing one of them:\
set 'action targets' according to your ControlEvents, like this:

```
[buttonName addTarget:self action:@selector(methodTouchDown:)             forControlEvents:UIControlEventTouchDown];
```

Here is MethodTouchDown declaration:

```
-(void)MethodTouchUpInside:(id)sender{  NSLog(@"Button is Clicked");}
```


---

Original Source: https://www.mindstick.com/forum/33656/detecting-events-on-tap-of-uibutton-in-ios

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
