How to get a reference to a method's caller object from within the method in Objective-C

Posted by shakeelw on Stack Overflow See other posts from Stack Overflow or by shakeelw
Published on 2010-05-14T12:53:20Z Indexed on 2010/05/14 12:54 UTC
Read the original article Hit count: 257

Filed under:
|

Hi guys. I have a few text fields and text views on my application's view. The keyboard comes up when I click in anyone of them. I have a method that gets called when any one of these objects is tapped in. However, I would like the method to execute its code only if the a certain Text Field(s) or a certain Text View(s) is tapped in. I would therefore like to have something like this in the method body:

{ if(currentField != mySpecialField) {return;}

 //Rest of the method code...

}

Now, my question is, how do I get a reference to the currently tapped in field so that I can perform the if-check.

Thanks guys. I'm a total noobee in Objective-C. :(

© Stack Overflow or respective owner

Related posts about objective-c

Related posts about iphone