Foundation framework, foundation
Foundation framework
1. Foundation Course Arrangement
1. NSObject, NSString, NSMutableString
2. NSNumber, NSValue, NSDate, and NSArray NSMutableArray
3. NSArray traversal, new NSArray syntax (IOS6), NSArray Copy, and NSArray sorting
4. NSSet, NSMutableSet, NSDictionary, NSMutableDictionary, and Block code segment (function pointer)
Ii. Api application interface documentation (manual)
Application Program Interface
Iii. Introduction to Foundation
Foundation Framework osx ios basic Framework
Class Library)
* Basic class:
NSObject, NSString, NSMutableString
NSNumber, NSValue, NSDate...
* Collection class:
NSArray, NSSet, NSMutableSet, NSDictionary, NSMutableDictionary
Network Type :...
File class :...
Iv. NSObject
1. Overview: the parent class of all classes provides some basic functions during system running.
2. class initialization
A. The + load method is automatically called during class loading.
B. When the class is used for the first time, the + initialize method is automatically called.
C. The class will execute this method only once before use
3. Create and release objects
Alloc init dealloc new ([xxx alloc] init])
4.-copy
A. Not all objects have the copy method. If an object supports the copy function, the copyWithZone method must be implemented in compliance with the NSCopying protocol.
B. If you want to copy not only the object but also the object value, you must override the initialization method with parameters.
5. Class Object
A. Class instantiation becomes an object and Class Object. (HEAP)
B. Load the class into the memory and create the Class Object (Code area) in the memory.
C. Common classes do not occupy the heap memory space, and class objects occupy the code zone space.
D. Send a class message to the class. You can create a class object.
Class class = [TRStudent class];
E. When comparing "class" information, you need to use class objects to determine whether a class is a subclass of another class.
[TRPerson isSubclassOfClass: [TRStudent class]
F. Avoid security issues when using Polymorphism
6. Method selector @ selector
A. Similar to function pointers in C
B. SEL is the sel method variable of the method type.
SEL sel = @ selector (study );
C. Whether a class has a method (Message)
BOOL B = [TRStudent instancesRespondToSelector: @ selector (study)]
D. Any messages can be sent to the object without the need to declare these messages during compilation.
[Stu2 example mselector: sel2];
Difference from sending messages to an object: The Compiler does not verify whether the method is declared and directly sends messages to the object. It is best to verify whether the message exists for the object to ensure code security.
7. Protocol Selector
A. Protocol reference points to a protocol
Protocol * p = @ protocol (NSCopying );
B. You can determine whether a class complies with a certain protocol.
BOOL B = [TRStudent conformsToProtocol: p];
8. Other Methods
A. determine whether a referenced object is of a certain type or child type.
-(BOOL) isKindOfClass :( Class) c;
B. Determine whether a referenced (Instance) object is of a certain type.
-(BOOL) isMemberOfClass :( Class) c;
C. When comparing class information, you need to use class objects to determine whether a class is a subclass of another class.
+ (BOOL) isSubclassOfClass :( Class) c;