View Full Version : Function & Variables names

Apr 22, 2011, 03:24 PM
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!

Apr 22, 2011, 05:24 PM
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;

Apr 22, 2011, 06:03 PM
Also, make sure you've reviewed this: Coding Guidelines for Cocoa (http://developer.apple.com/library/ios/#documentation/Cocoa/Conceptual/CodingGuidelines/CodingGuidelines.html)

Apr 23, 2011, 04:05 PM
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.