Runtime 요약
/// An opaque type that represents a method in a class definition.
typedef struct objc_method *Method;
/// An opaque type that represents an instance variable.
typedef struct objc_ivar *Ivar;
/// An opaque type that represents a category.
typedef struct objc_category *Category;
/// An opaque type that represents an Objective-C declared property.
typedef struct objc_property *objc_property_t;
struct objc_class {
Class isa ;
#if !__OBJC2__
Class super_class ; //
const char *name ; //
long version ;
long info ;
long instance_size;
struct objc_ivar_list *ivars; //
struct objc_method_list **methodLists; //
struct objc_cache *cache ; //
struct objc_protocol_list *protocols ; //
#endif
} OBJC2_UNAVAILABLE;
unsigned int count;
objc_property_t *propertyList = class_copyPropertyList([self class], &count);
for (unsigned int i = 0; i < count; i++) {
const char *propertyName = property_getName(propertyList[i]);
NSLog(@"proprety--->%@",[NSString stringWithUTF8String:propertyName]);
}
unsigned int count;
//
Ivar *ivarList = class_copyIvarList([self class], &count);
for (unsigned int i; i%@", [NSString stringWithUTF8String:ivarname]);
}
// self
- (void)getMethods
{
unsigned int count;
Method *methodlist = class_copyMethodList([self class], &count);
for (int i = 0; i < count; i ++) {
Method method = methodlist[i];
NSLog(@"method---> %@",NSStringFromSelector(method_getName(method)));
}
}
// self
- (void)getProtocals
{
unsigned int count;
__unsafe_unretained Protocol **protocolLsit = class_copyProtocolList([self class], &count);
for (int i = 0; i < count; i++) {
Protocol *protocol = protocolLsit[i];
const char *protoalName = protocol_getName(protocol);
NSLog(@"protocol---> %@",[NSString stringWithUTF8String:protoalName]);
}
}
// key
static char objcKey;
//
- (void)setObjcName:(NSString *)objcName
{
objc_setAssociatedObject(self, &objcKey, objcName, OBJC_ASSOCIATION_RETAIN_NONATOMIC);
}
- (NSString *)objcName
{
return objc_getAssociatedObject(self, &objcKey);;
}
2016-03-31 18:19:34.350 RumtimeModel[9164:325075] ivar--->_girl0
2016-03-31 18:19:34.350 RumtimeModel[9164:325075] ivar--->_girl1
2016-03-31 18:19:34.351 RumtimeModel[9164:325075] ivar--->_girl2
2016-03-31 18:19:34.351 RumtimeModel[9164:325075] ivar--->_girl3
2016-03-31 18:19:34.352 RumtimeModel[9164:325075] proprety--->girl0
2016-03-31 18:19:34.353 RumtimeModel[9164:325075] proprety--->girl1
2016-03-31 18:19:34.353 RumtimeModel[9164:325075] proprety--->girl2
2016-03-31 18:19:34.353 RumtimeModel[9164:325075] proprety--->girl3
2016-03-31 18:19:34.388 RumtimeModel[9164:325075] method---> setDicData:
2016-03-31 18:19:34.389 RumtimeModel[9164:325075] method---> dicData
2016-03-31 18:19:34.389 RumtimeModel[9164:325075] method---> getMethods
2016-03-31 18:19:34.389 RumtimeModel[9164:325075] method---> getProtocals
2016-03-31 18:19:34.389 RumtimeModel[9164:325075] method---> categotyString
2016-03-31 18:19:34.390 RumtimeModel[9164:325075] method---> .cxx_destruct
2016-03-31 18:19:34.390 RumtimeModel[9164:325075] method---> tableView:numberOfRowsInSection:
2016-03-31 18:19:34.390 RumtimeModel[9164:325075] method---> tableView:cellForRowAtIndexPath:
2016-03-31 18:19:34.390 RumtimeModel[9164:325075] method---> numberOfSectionsInTableView:
2016-03-31 18:19:34.391 RumtimeModel[9164:325075] method---> didReceiveMemoryWarning
2016-03-31 18:19:34.391 RumtimeModel[9164:325075] method---> viewDidLoad
2016-03-31 18:19:34.391 RumtimeModel[9164:325075] protocol---> UITableViewDataSource
2016-03-31 18:19:34.391 RumtimeModel[9164:325075] protocol---> UITableViewDelegate
2016-03-31 18:19:34.392 RumtimeModel[9164:325075] category----> HHLM
이 내용에 흥미가 있습니까?
현재 기사가 여러분의 문제를 해결하지 못하는 경우 AI 엔진은 머신러닝 분석(스마트 모델이 방금 만들어져 부정확한 경우가 있을 수 있음)을 통해 가장 유사한 기사를 추천합니다:
다양한 언어의 JSONJSON은 Javascript 표기법을 사용하여 데이터 구조를 레이아웃하는 데이터 형식입니다. 그러나 Javascript가 코드에서 이러한 구조를 나타낼 수 있는 유일한 언어는 아닙니다. 저는 일반적으로 '객체'{}...
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
CC BY-SA 2.5, CC BY-SA 3.0 및 CC BY-SA 4.0에 따라 라이센스가 부여됩니다.