Re: [Pyobjc-dev] class vs. instance attributes for IBOutlets
Brought to you by:
ronaldoussoren
|
From: Ronald O. <ron...@ma...> - 2009-02-03 12:56:30
|
On 13 Oct, 2008, at 4:13, Greg Ewing wrote: > Joe Strout wrote: > >> But whether this applies to IBOutlets, I >> have no idea -- I don't understand what they are or how they work. > > I think the IBOutlet is just a marker indicating > that the attribute in question is an outlet, and > it doesn't hold any state -- in which case sharing > it between instances is fine. I haven't read pyobjc-dev for a while (for various reasons). objc.IBOutlet and objc.ivar define fields in the Objective-C class and *must* be used at the class level. They basicly claim space in the memory layout of the ObjC instances and are somewhat comparible to the __slots__ attribute in pure Python classes. That is: class MyClass (NSObject): foo = objc.IBOutlet() bar = objc.ivar() This code results in an ObjC class that has two instance variables, "foo" and "bar", that can contain references to arbitrary object. The objc.IBOutlet is intented to be used from Interface builder and will automaticly show up in IB when you create an instance of the class there. Ronald > > > -- > Greg > > ------------------------------------------------------------------------- > This SF.Net email is sponsored by the Moblin Your Move Developer's > challenge > Build the coolest Linux based applications with Moblin SDK & win > great prizes > Grand prize is a trip for two to an Open Source event anywhere in > the world > http://moblin-contest.org/redirect.php?banner_id=100&url=/ > _______________________________________________ > Pyobjc-dev mailing list > Pyo...@li... > https://lists.sourceforge.net/lists/listinfo/pyobjc-dev |