使用class_createInstance
官方文档里内容:
Creates an instance of a class, allocating memory for the class in the default malloc memory zone.
id class_createInstance(Class cls, size_t extraBytes)
Parameters
cls
The class that you wish to allocate an instance of.
extraBytes
An integer indicating the number of extra bytes to allocate. The additional bytes can be used to store additional instance variables beyond those defined in the class definition.
Return Value
An instance of the class cls.
Declared In
runtime.h
参考资料
http://developer.apple.com/library/ma...