Πέμπτη, 10 Μαΐου 2012

Name conventions - conventions


  • Ref, CGContextRef is a pointer to struct CGContext. The suffix Ref makes it easy to distinguish between pointers to C structures and pointers to Objective-C objects. 
  • At saved images you can use the @2x addition to annotate that this file is to be display if retina display exists. Example we save "apple.png" and "apple@2x.png". The first picture, it will be used on Non retina displays and the second will be used if retina display exists. The selection is automatic. example UIImage * i = [[UIImage imageNamed:@"apple.png"];
  • By convention, the reuse identifier  of every cell (from UITableViewCell) is simply the name of the cell class. If you have a table view that uses multiple styles of the same type of cell, you can suffix the reuse identifier with the name of that style, e.g. UITableViewCell-Default


  • NSCoder: Regardless of the type of the encoded value, there is always a key, which is a string that identifies which instance variable is being encoded. By convention, this key is the name of the instance variable being encoded. 
  • The key on NSUserDefaults (is a NSMutableDictionary) that holds the application preferences is the name of the application, the name of the preference, and the words PrefKey. This is the typical pattern for naming preference keys
  • Class meethods come first, followed by initializers, followed by any other methods. This is a convention that makes you header files easier to read. 

Δεν υπάρχουν σχόλια:

Δημοσίευση σχολίου