@interface ObjCClass : NSObject {
NSString *aString;
}
@property (retain) NSString *aString;
@end
@implementation ObjCClass
@synthesize aString;
- (id) init
{
self = [super init];
if (self != nil)
{
aString = @"hello from obj-c";
}
return self;
}
@end
We modify the python file by adding a subclass declaration:
from Foundation import *
import objc
ObjCClass = objc.lookUpClass("ObjCClass")
class TestClass (ObjCClass):
def doit_(self, input):
print "sent from obj-C:", input
print "obj-C attribute:", self.aString()
self.setAString_("python modified attribute")
return "hello from Python"
The ObjCClass = objc.lookUpClass("ObjCClass") responsible for finding class in objective C. Note that when we use this, it is impossible to run this Python script alone.
1 comments:
школьницы порно онлайн смотреть http://free-3x.com/ порно онлайн видео малолетки смотреть free-3x.com/ трахнул молоденькую онлайн [url=http://free-3x.com/]free-3x.com[/url]
Post a Comment