1. Welcome to the new MacRumors forums. See our announcement and read our FAQ

Function & Variables names

Discussion in 'iPhone/iPad Programming' started by Nnavick, Apr 22, 2011.

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

    macrumors regular

    #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

    robbieduncan

    Staff Member

    #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

    #3
  4. macrumors 603

    #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