iOS DeveloperiOS 开发

苹果编码规范(4)

2016-06-17  本文已影响89人  C93zzo

“写游记,说我泄露国家机密。写历史,就说我借古讽今。注解兵法,又说我策动谋反。写神怪故事吧,又说我导人迷信。最后改写名人传记,嘿嘿,结果这个名人失事,被定为乱党,我跟他一块被判个终生监禁……”  -------倩女幽魂2

原文地址:

https://developer.apple.com/library/mac/documentation/Cocoa/Conceptual/CodingGuidelines/Articles/APIAbbreviations.html#//apple_ref/doc/uid/20001285-BCIHCGAE

可接受的缩写

通常来讲,你设计接口的时候,不要使用缩写。但是下面列出的缩写你可以继续使用,同时注意下面两点:

1标准c中的缩写如:alloc” 和 “getc可以使用

2参数名字可以用缩写。如:imageRep”, “col” , “obj”, “otherWin”

alloc                                               Allocate.

alt                                                   Alternate.

app                                                 Application.

calc                                                 Calculate.

dealloc                                           Deallocate.

func                                                 Function.

horiz                                                Horizontal.

info                                                  Information.

init                                                   Initialize 

int                                                    Integer 

max                                                  Maximum.

min                                                  Minimum.

msg                                                  Message.

nib                                                  Interface Builder archive.

pboard                                          Pasteboard (but only in constants).

rect                                                    Rectangle.

Rep                                                  Representation (used in class name such asNSBitmapImageRep).

temp                                                Temporary.

vert                                                  Vertical.

以及:

ASCII

PDF

XML

HTML

URL

RTF

HTTP

TIFF

JPG

PNG

GIF

LZW

ROM

RGB

CMYK

MIDI

FTP

---------------------完

其实还有一点没翻译,但是那点就不翻了。

最后发一张猫图。

上一篇下一篇

猜你喜欢

热点阅读