zoukankan      html  css  js  c++  java
  • NSObject

    Objective-C是动态语言,每个类class都会在运行时创建一个类对象。

    NSObject是根类,当然是最重要的一个类,提供的一些公共方法,顾名思议。

    @protocol NSObject
    // 是否引用同一对象
    - (BOOL)isEqual:(id)object;
    - (NSUInteger)hash;
    
    - (Class)superclass; - (Class)class; - (id)self; - (NSZone *)zone NS_AUTOMATED_REFCOUNT_UNAVAILABLE;
    - (id)performSelector:(SEL)aSelector; - (id)performSelector:(SEL)aSelector withObject:(id)object; - (id)performSelector:(SEL)aSelector withObject:(id)object1 withObject:(id)object2; - (BOOL)isProxy; - (BOOL)isKindOfClass:(Class)aClass; - (BOOL)isMemberOfClass:(Class)aClass; - (BOOL)conformsToProtocol:(Protocol *)aProtocol; - (BOOL)respondsToSelector:(SEL)aSelector; - (id)retain NS_AUTOMATED_REFCOUNT_UNAVAILABLE; - (oneway void)release NS_AUTOMATED_REFCOUNT_UNAVAILABLE; - (id)autorelease NS_AUTOMATED_REFCOUNT_UNAVAILABLE; - (NSUInteger)retainCount NS_AUTOMATED_REFCOUNT_UNAVAILABLE; - (NSString *)description; @optional - (NSString *)debugDescription; @end // 浅copy @protocol NSCopying - (id)copyWithZone:(NSZone *)zone; @end // 深copy @protocol NSMutableCopying - (id)mutableCopyWithZone:(NSZone *)zone; @end // 序列化 @protocol NSCoding - (void)encodeWithCoder:(NSCoder *)aCoder; - (id)initWithCoder:(NSCoder *)aDecoder; @end // Objects which are safe to be encoded and decoded across privilege boundaries should adopt NSSecureCoding instead of NSCoding. Secure coders (those that respond YES to requiresSecureCoding) will only encode objects that adopt the NSSecureCoding protocol. @protocol NSSecureCoding <NSCoding> @required // This method must be return YES on all classes that allow secure coding. Subclasses of classes that adopt NSSecureCoding and override initWithCoder: must also override this method and return YES. // The Secure Coding Guide should be consulted when writing methods that decode data. + (BOOL)supportsSecureCoding; @end /*********** Base class ***********/ NS_ROOT_CLASS @interface NSObject <NSObject> { Class isa; } + (void)load; + (void)initialize; - (id)init; + (id)new; + (id)allocWithZone:(NSZone *)zone; + (id)alloc; - (void)dealloc; - (void)finalize; - (id)copy; - (id)mutableCopy; + (id)copyWithZone:(NSZone *)zone NS_AUTOMATED_REFCOUNT_UNAVAILABLE; + (id)mutableCopyWithZone:(NSZone *)zone NS_AUTOMATED_REFCOUNT_UNAVAILABLE; + (Class)superclass; + (Class)class; + (BOOL)instancesRespondToSelector:(SEL)aSelector; + (BOOL)conformsToProtocol:(Protocol *)protocol; - (IMP)methodForSelector:(SEL)aSelector; + (IMP)instanceMethodForSelector:(SEL)aSelector; - (void)doesNotRecognizeSelector:(SEL)aSelector; - (id)forwardingTargetForSelector:(SEL)aSelector NS_AVAILABLE(10_5, 2_0); - (void)forwardInvocation:(NSInvocation *)anInvocation; - (NSMethodSignature *)methodSignatureForSelector:(SEL)aSelector; + (NSMethodSignature *)instanceMethodSignatureForSelector:(SEL)aSelector; - (BOOL)allowsWeakReference NS_UNAVAILABLE; - (BOOL)retainWeakReference NS_UNAVAILABLE; + (NSString *)description; + (BOOL)isSubclassOfClass:(Class)aClass; + (BOOL)resolveClassMethod:(SEL)sel NS_AVAILABLE(10_5, 2_0); + (BOOL)resolveInstanceMethod:(SEL)sel NS_AVAILABLE(10_5, 2_0); @end @interface NSObject (NSCoderMethods) + (NSInteger)version; + (void)setVersion:(NSInteger)aVersion; - (Class)classForCoder; - (id)replacementObjectForCoder:(NSCoder *)aCoder; - (id)awakeAfterUsingCoder:(NSCoder *)aDecoder NS_REPLACES_RECEIVER; @end
  • 相关阅读:
    排序算法之快速排序
    设计模式之原型模式
    设计模式之门面模式
    第五十四课 树中节点的插入操作
    第五十三课 树中节点的查找操作
    第五十二课 树的存储结构与实现
    第五十一课 树的定义与操作
    第五十课 排序的工程应用示例
    第四十九课 归并排序和快速排序
    第四十八课 冒泡排序和希尔排序
  • 原文地址:https://www.cnblogs.com/iprogrammer/p/3252332.html
Copyright © 2011-2022 走看看