get button object from title

Discussion in 'iOS Programming' started by becu, May 28, 2009.

  1. becu macrumors newbie

    Apr 21, 2009
    I need to get the receiver (UIButton in this case), but all I have is the button's title. Do we have a method for this? Thanks.
  2. robbieduncan Moderator emeritus


    Jul 24, 2002
    It's not generically possible: there is nothing preventing two or more buttons on screen having the same title. You can easily get the top-level view on the screen and iterate through all sub-view (and their sub-views) checking the type and titles. I have to say though that if you need to do this you are almost certainly doing something the wrong way.

Share This Page