📜  Obj-C基础框架

📅  最后修改于: 2020-11-03 16:03:38             🧑  作者: Mango


如果您参考Apple文档,则可以看到基金会框架的详细信息,如下所示。

Foundation框架定义了Objective-C类的基础层。除了提供一组有用的原始对象类之外,它还引入了一些范式,这些范式定义了Objective-C语言未涵盖的功能。设计基金会框架时要牢记这些目标-

  • 提供少量基本实用程序类。

  • 通过引入诸如取消分配之类的一致约定来简化软件开发。

  • 支持Unicode字符串,对象持久性和对象分发。

  • 提供一定级别的操作系统独立性,以增强可移植性。

该框架由NeXTStep开发,并被Apple收购,这些基础类成为Mac OS X和iOS的一部分。由NeXTStep开发,它的类前缀为“ NS”。

我们在所有示例程序中都使用了Foundation Framework。使用Foundation Framework几乎是必须的。

通常,我们使用#import 类的东西来导入Objective-C类,但是为了避免导入太多的类,所有这些类都被导入了#import

NSObject是所有对象的基础类,包括基础工具包类。它提供了内存管理方法。它还提供了到运行时系统的基本接口,并具有充当Objective-C对象的功能。它没有任何基类,并且是所有类的根。

基于功能的基础类

Sr.No. Loop Type & Description
1 Data storage

NSArray, NSDictionary, and NSSet provide storage for Objective-C objects of any class.

2 Text and strings

NSCharacterSet represents various groupings of characters that are used by the NSString and NSScanner classes. The NSString classes represent text strings and provide methods for searching, combining, and comparing strings. An NSScanner object is used to scan numbers and words from an NSString object.

3 Dates and times

The NSDate, NSTimeZone, and NSCalendar classes store times and dates and represent calendrical information. They offer methods for calculating date and time differences. Together with NSLocale, they provide methods for displaying dates and times in many formats and for adjusting times and dates based on location in the world.

4 Exception handling

Exception handling is used to handle unexpected situations and it’s offered in Objective-C with NSException.

5 File handling

File handling is done with the help of class NSFileManager.

6 URL loading system

A set of classes and protocols that provide access to common Internet protocols.