开发者

what is equivalent to Java packages in iPhone OS?

I want to know which is the equivalent concept of Java packages in iPhone. Is it bundling or Static library?开发者_如何学C


Java Packages imply namespace, which doesn't exist in Objective-C. However, XCode supports Groups for managing common code (basically placed in their own directory). Libraries are typically delivered as a Framework.

This are added to a project as a framework.

For example,

  1. Address Book
  2. OpenGL
  3. Third Party


Java packages are used to avoids namespace collision, which is a situation where two pieces of code have the same name but do different things.

To do this in objective C - add prefix your class names with initials. All class created in cocoa framework have a prefix 'NS'. You can define your own prefix for your code.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜