Objective-c - The objects returned by self and [self class] in the +load method are the same
某草草
某草草 2017-05-02 09:26:54
0
2
683

cls and selfcls point to the same address (RuntimeViewController class object).

According to the class structure of oc, shouldn’t [self class] point to the metaclass of RuntimeViewController?

某草草
某草草

reply all(2)
PHPzhong

Look at this and you will understand
http://xiongzenghuidegithub.github.io/blog/2016/05/17/runtime-part7-object-getclass-yu-object-class-de-qu-bie/

phpcn_u1582


    //实例对象调用class时返回isa指向的objc_object
    -class
    {
        return (id)isa; 
    }
    
    //类对象调用class时返回类对象自己
    +class 
    {
        return self;
    }
    
    
    //取自Object.h Object.m
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template