美文网首页
iOS ~ NSObject协议

iOS ~ NSObject协议

作者: 水中的蓝天 | 来源:发表于2020-04-21 11:44 被阅读0次

    本文源自本人的学习记录整理与理解,其中参考阅读了部分优秀的博客和书籍,尽量以通俗简单的语句转述。引用到的地方如有遗漏或未能一一列举原文出处还望见谅与指出,另文章内容如有不妥之处还望指教,万分感谢。

    NSObject协议

    NSObject基类是自动遵循< NSObject >协议的,
    开发中经常会用到的performSelector:就属于该协议中的方法,
    继承自NSObject的类不需要再去遵循协议

    @protocol NSObject
    
    - (BOOL)isEqual:(id)object;
    
    @property (readonly) NSUInteger hash;
    
    @property (readonly) Class superclass;
    
    - (Class)class OBJC_SWIFT_UNAVAILABLE("use 'type(of: anObject)' instead");
    
    - (instancetype)self;
    
    - (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;
    
    - (instancetype)retain OBJC_ARC_UNAVAILABLE;
    - (oneway void)release OBJC_ARC_UNAVAILABLE;
    - (instancetype)autorelease OBJC_ARC_UNAVAILABLE;
    - (NSUInteger)retainCount OBJC_ARC_UNAVAILABLE;
    
    - (struct _NSZone *)zone OBJC_ARC_UNAVAILABLE;
    
    @property (readonly, copy) NSString *description;
    @optional
    @property (readonly, copy) NSString *debugDescription;
    
    @end
    

    相关文章

      网友评论

          本文标题:iOS ~ NSObject协议

          本文链接:https://www.haomeiwen.com/subject/giquihtx.html