为什么Objective-C中有很多类是以NS、UI开头的

来源:互联网 发布:恋爱软件免费版 编辑:程序博客网 时间:2024/05/23 01:14

在阅读苹果的官方文档的时候看到的解释:


Historical Note: If you’re wondering why so many of the classes you encounter have anNS prefix, it’s because of the past history of Cocoa and Cocoa Touch. Cocoa began life as the collected frameworks used to build apps for the NeXTStep operating system. When Apple purchased NeXT back in 1996, much of NeXTStep was incorporated into OS X, including the existing class names. Cocoa Touch was introduced as the iOS equivalent of Cocoa; some classes are available in both Cocoa and Cocoa Touch, though there are also a large number of classes unique to each platform.

Two-letter prefixes like NS and UI (for User Interface elements on iOS) are reserved for use by Apple.

0 0
原创粉丝点击