Tutorial :Problem with class_getInstanceSize



Question:

I have my class derived from UITabBar:

@interface 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?


Solution:1

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.


Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »