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

    since I stated developing for iphone i don't understand this issue,
    I want to know how to write function & variables names,I mean,


    and variables

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

    how do you write them?

    Thank you!
  2. Moderator


    Staff Member

    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:
    -(BOOL) isOpen;
  3. Moderator


    Staff Member

  4. macrumors 603

    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