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
  • 相关阅读:
    js-----面向对象=====>工厂模式/构造函数/原型模式
    MarkDown语法
    Vue 基础篇
    CSS 预处理语言之 less 篇
    Git常用命令
    与 JSON 相关的一些操作 (项目中用到一部分,后续逐渐完善)
    [转] -- html5手机网站自适应需要加的meta标签
    [转] -- 最全前端资源汇集
    json和jsonp的区别,ajax和jsonp的区别
    对象
  • 原文地址:https://www.cnblogs.com/iprogrammer/p/3252332.html
Copyright © 2011-2022 走看看