Function & Variables names

Discussion in 'iOS Programming' started by Nnavick, Apr 22, 2011.

  1. Nnavick, Apr 22, 2011
    Last edited: Apr 22, 2011

    macrumors regular

    Joined:
    Oct 13, 2010
    #1
    Hi,
    since I stated developing for iphone i don't understand this issue,
    I want to know how to write function & variables names,I mean,

    -(void)is_open;?
    -(void)Is_Open;?
    -(void)IsOpen;?
    -(void)isOpen;?

    and variables

    IBOutlet UIButton *cancelButton;?
    IBOutlet UIButton *cancel_button;?

    how do you write them?

    Thank you!
     
  2. Moderator emeritus

    robbieduncan

    Joined:
    Jul 24, 2002
    Location:
    London
    #2
    Look at any Apple class. Method names always start with a lower case letter and then each subsequent word is has an initial upper case letter. Words are never separated by underscores. So there is only one viable answer:
    Code:
    -(BOOL) isOpen;
    
     
  3. Moderator

    dejo

    Staff Member

    Joined:
    Sep 2, 2004
    Location:
    The Centennial State
  4. macrumors 603

    Joined:
    Jul 29, 2003
    Location:
    Silicon Valley
    #4
    C naming is case sensitive and allows underscores. Anything that you find readable will work. If you read a lot of Apple sample code and find that to be a readable coding style, you might want to copy those naming convention. If not, don't. The C code will still compile just fine.
     

Share This Page