addTarget selectors

Discussion in 'iOS Programming' started by mobidev, Oct 14, 2010.

  1. mobidev macrumors member

    Joined:
    Nov 20, 2009
    #1
    Hi,


    I got a basic doubt regarding the selectors of the button (uibutton) action.

    i) I had observed that selector method can be used without having the declaration in the .h file. Is there any logic behind the frame work of iphone sdk in this matter.

    ii) Also, return values I have seen are IBAction, id and void. Where does the actual value is returned, and how can we use the returned id value.

    Can any one please make the Basic questions clear..

    Thanks.
     
  2. dejo Moderator

    dejo

    Staff Member

    Joined:
    Sep 2, 2004
    Location:
    The Centennial State
    #2
    Yes, the logic is all related to whether a method is made public or not, and has much more to do with basic Objective-C than the iPhone SDK.

    Where have you seen an action method return an id? Do you have a link?
     
  3. Sykte macrumors regular

    Joined:
    Aug 26, 2010
    #3

    IBAction is actually a special keyword that interface builder uses to know which methods you want to connect to in your header. The definition of IBAction is void. You can verify this by checking the header file or apple documention. So you may see either IBAction or void.

    Are you coming from Visual Basic?
     
  4. mobidev thread starter macrumors member

    Joined:
    Nov 20, 2009
    #4
    I actually have seen in some code on the sites... didn't remember exactly. They used to return self from the selector.
     
  5. dejo Moderator

    dejo

    Staff Member

    Joined:
    Sep 2, 2004
    Location:
    The Centennial State
    #5
    Wirelessly posted (Mozilla/5.0 (iPhone; U; CPU iPhone OS 4_2 like Mac OS X; en-us) AppleWebKit/533.17.9 (KHTML, like Gecko) Version/5.0.2 Mobile/8C5115c Safari/6533.18.5)

    Were they init methods?
     

Share This Page