As far as what I remember, as the Stanford iOS development courses' teaching 
(where I picked up Objective-C), you should almost always access ivars using 
accessor methods, especially if they are declared as @property's and got 
@synthesize'd.

在 2012-10-25,上午4:49,Quentin Mathé <[email protected]> 写道:

> Le 9 sept. 2012 à 06:41, Banlu Kemiyatorn a écrit :
> 
>> Hi, I have one quick question about Traits. 
>> AFAIK Traits methods need to access ivars via accessors. But I wonder if the 
>> Traits class have the similar or partially similar layout, like one or two 
>> matching ivars after isa, would that be possible for traits methods to 
>> access the correct ivar in the applied class? Sorry I should just test this 
>> out but I have no access to a proper machine ATM. 
> 
> I asked the question a while ago to David, but I cannot remember his exact 
> answer.
> 
> I would say that should work if the Trait class and its superclasses, and the 
> targeted class and its superclasses, all use the same exact ivar layout. The 
> important point would be to check every superclass in both class hierarchies 
> (trait and target) to ensure they result in the same ivar layout for an 
> instance.
> 
> Cheers,
> Quentin.
> _______________________________________________
> Etoile-discuss mailing list
> [email protected]
> https://mail.gna.org/listinfo/etoile-discuss


_______________________________________________
Etoile-discuss mailing list
[email protected]
https://mail.gna.org/listinfo/etoile-discuss

Répondre à