/* NSObject.h
Copyright (c) 1994-2009, Apple Inc. All rights reserved.
*/
#import <Foundation/NSObjCRuntime.h>
#import <Foundation/NSZone.h>
@class NSInvocation, NSMethodSignature, NSCoder, NSString, NSEnumerator;
@class Protocol;
/*************** Basic protocols ***************/
@protocol NSObject
- (BOOL)isEqual:(id)object;
- (NSUInteger)hash;
- (Class)superclass;
- (Class)class;
- (id)self;
- (NSZone *)zone;
- (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;
- (oneway void)release;
- (id)autorelease;
- (NSUInteger)retainCount;
- (NSString *)description;
@end
@protocol NSCopying
- (id)copyWithZone:(NSZone *)zone;
@end
@protocol NSMutableCopying
- (id)mutableCopyWithZone:(NSZone *)zone;
@end
@protocol NSCoding
- (void)encodeWithCoder:(NSCoder *)aCoder;
- (id)initWithCoder:(NSCoder *)aDecoder;
@end
/*********** Base class ***********/
@interface NSObject <NSObject> {
Class isa;
}
+ (void)load;
+ (void)initialize;
- (id)init;
+ (id)new;
+ (id)allocWithZone:(NSZone *)zone;
+ (id)alloc;
- (void)dealloc;
- (void)finalize AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER;
- (id)copy;
- (id)mutableCopy;
+ (id)copyWithZone:(NSZone *)zone;
+ (id)mutableCopyWithZone:(NSZone *)zone;
+ (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;
- (void)forwardInvocation:(NSInvocation *)anInvocation;
- (NSMethodSignature *)methodSignatureForSelector:(SEL)aSelector;
+ (NSMethodSignature *)instanceMethodSignatureForSelector:(SEL)aSelector;
+ (NSString *)description;
+ (BOOL)isSubclassOfClass:(Class)aClass AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER;
+ (BOOL)resolveClassMethod:(SEL)sel AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
+ (BOOL)resolveInstanceMethod:(SEL)sel AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
@end
@interface NSObject (NSCoderMethods)
+ (NSInteger)version;
+ (void)setVersion:(NSInteger)aVersion;
- (Class)classForCoder;
- (id)replacementObjectForCoder:(NSCoder *)aCoder;
- (id)awakeAfterUsingCoder:(NSCoder *)aDecoder;
@end
#if (TARGET_OS_MAC && !(TARGET_OS_EMBEDDED || TARGET_OS_IPHONE))
@interface NSObject (NSDeprecatedMethods)
+ (void)poseAsClass:(Class)aClass DEPRECATED_IN_MAC_OS_X_VERSION_10_5_AND_LATER
#if __OBJC2__
UNAVAILABLE_ATTRIBUTE
#endif
;
@end
#endif
#if MAC_OS_X_VERSION_10_6 <= MAC_OS_X_VERSION_MAX_ALLOWED
/*********** Discardable Content ***********/
@protocol NSDiscardableContent
@required
- (BOOL)beginContentAccess;
- (void)endContentAccess;
- (void)discardContentIfPossible;
- (BOOL)isContentDiscarded;
@end
@interface NSObject (NSDiscardableContentProxy)
- (id)autoContentAccessingProxy AVAILABLE_MAC_OS_X_VERSION_10_6_AND_LATER;
@end
#endif
/*********** Object Allocation / Deallocation *******/
FOUNDATION_EXPORT id NSAllocateObject(Class aClass, NSUInteger extraBytes, NSZone *zone);
FOUNDATION_EXPORT void NSDeallocateObject(id object);
FOUNDATION_EXPORT id NSCopyObject(id object, NSUInteger extraBytes, NSZone *zone);
FOUNDATION_EXPORT BOOL NSShouldRetainWithZone(id anObject, NSZone *requestedZone);
FOUNDATION_EXPORT void NSIncrementExtraRefCount(id object);
FOUNDATION_EXPORT BOOL NSDecrementExtraRefCountWasZero(id object);
FOUNDATION_EXPORT NSUInteger NSExtraRefCount(id object);
分享到:
相关推荐
dsdump 改进的nm + objc / swift类转储.../Users/x/Desktop/classes/NSObject.h /Users/x/Desktop/classes/XMIAudioPlayerListProtocol.h /Users/x/Desktop/classes/UIScrollViewDelegate.h /Users/x/Desktop/classe
是包含在 Foundation classes(基本类别库)中(即 import NSObject.h;nil 也 是包括在这个标头档内)。BOOL 在 Objective-C 中有两种型态:YES 或 NO,而不是 TRUE 或 FALSE。 n #import vs #include:就如同你在 ...
本文主要介绍Objective-C对象模型的实现细节,以及Objective-C语言对象模型中对isaswizzling和methodswizzling的支持。希望本文能加深你对Objective-C对象的理解。...在XCode中按Shift+Command+O,然后输入NSObject.h
Xcode then generates two new files for your project: MyClass.h and MyClass.m. They contain the code of an empty class, as in the header and implementation files shown in Listing 1-5 and Listing 1-6. ...
#import "NSObject+JKLocalStore.h" @interface ViewController () @end @implementation ViewController - (void)viewDidLoad { [super viewDidLoad]; StudentModel *student = [[StudentModel alloc] init...
// --- User.h --- // @interface User : NSObject @property (nonatomic, strong) NSString *name; @property (nonatomic, assign) NSIntger userId; @property (nonatomic, strong) NSDate *...
LRVariadicPerformSelector 因为有时候,我们需要... 将NSObject+LRVariadicPerformSelector.h/m文件夹NSObject+LRVariadicPerformSelector.h/m您的项目中。用法[self lr_performSelector:@selector(because:sometimes:
Demo中有一个NSObject WHRuntime.h分类,包含与runtime有关的方法,可以直接拿来使用。
自动属性初始化AutoPropertyInit是一个NSObject... # import " AutoInit.h "# import " NSObject+AutoPropertyInit.h "@implementation AutoInit- ( instancetype ) init { self = [ super init ]; if (self) { [ self
接下来,我们会从 objc 库中的 NSObject.mm、 objc-weak.h 以及 objc-weak.mm 文件出发,去具体了解 weak 的实现过程。 weak 的内部结构 Runtime 维护了一个weak表,用于存储指向某个对象的所有weak指针。weak 表是...
@interface DevicePlatform : NSObject //返回设备型号 如:iPhone4 或 iPhone6 + (NSString *)platform; //判断是不是iPhone6 + (BOOL)iPhone6; //判断是不是iPhone6Plus + (BOOL)iPhone6Plus; //判断是不是...
@interface XmlResolve : NSObject { } @property (nonatomic, retain)NSString *objName; @property BOOL *isList; @property (nonatomic, retain) NSMutableString *currentResult; @property (nonatomic,...
我注意到您提到的是 Objective-C 语言,这是一种主要用于 macOS 和 iOS 开发的编程语言。下面是一个简要的 Objective-C 语言教程和一个基本的案例。...@interface Person : NSObject @property NSString *name; @
描述NSObjectCoder是一个... 对于扩展任何类NSObject ,你想进行编码和解码,进口NSObjectCoder.h到您.h文件: # import `NSObjectCoder.h`将以下代码复制并粘贴到.m文件中: 对于编码: - ( void )encodeWithCoder:
TrReadWriteLock ...NSObject+TrReadWriteLockAdditions.h NSObject+TrReadWriteLockAdditions.m 如果将其添加到您的<myproject> -Prefix.h文件,您将使自己的工作变得简单得多: #include "NSObject+Tr
AHDirectionsObject是一个NSObject类,旨在使打开其他地图应用程序变得轻而易举。 此类是为我们最新的iOS应用程序[All Hours]( )开发的,请确保将其签出! 技术支持 苹果地图(显然) 城市地图 谷歌地图 位智 ...
首先NewFile创建类,选iOS中的Cocoa Touch,再点击Objective-C class,输入类名Student,作为NSobject(系统 自带)的子类 2>.在.h中做方法的声明 在Student.h中: //@interface代表声明一个类 // : 代表继承 #...
#import <Foundation/Foundation.h> #import <StoreKit/StoreKit.h> #import <StoreKit/SKPaymentTransaction.h> @class RMIAPHelper; @protocol RMIAPHelperDelegate <NSObject> //购买 -(void)requestProduct:...
#import "NSObject+OKObserver.h" // Optional ##例子 self.ok_observer.control(self.field1, UIControlEventEditingChanged, ^(typeof (self) me, UITextField *field) { me. i = [field.text integerValue ]; ...