Problem with class_getInstanceSize
I have my class derived from UITabBar:
@inte开发者_JAVA技巧rface MyTabBar : UITabBar
@end
@implementation MyTabBar
@end
Further, in my code, I call class_getInstanceSize for my class and system UITabBar class:
size_t origSize = class_getInstanceSize([UITabBar class]);
size_t mySize = class_getInstanceSize([MyTabBar class]);
I use iOS SDK 4.1. When I run on iPhone Simulator (iPhone 4) i get the same value for origSize and mySize. But if I run on real device with SDK 3.1.3 I get different values, 68 for origSize and 80 for mySize. How can it be?
Most likely they changed the implementation of subclassing behind the scenes. You should log the return of class
for each OS to find out if your still dealing with the same class behind the scenes. Chances are good that you are not. They may be in the process of migrating one class to another in a class cluster.
精彩评论