Adding methods to Objective-c classes during runtime (via Spiced Cocoa)

07jun10

Dit is nog eens vet!

Why you might wonder? World domination of course! Here goes! #import <Foundation/Foundation.h> #import <objc/runtime.h> @interface MyInterface : NSObject { NSString *string; } @property (nonatomic, retain) NSString *string; @end @implementation MyInterface @synthesize string; @end // The method we want to add to class `MyInterface` void printSelfIMP(id self, SEL _cmd, …) { NSLog(@"I'm off class %@ and it holds the following string: … Read More

via Spiced Cocoa



Nog geen reacties op “Adding methods to Objective-c classes during runtime (via Spiced Cocoa)”

  1. Geef een reactie

Geef een reactie

Fill in your details below or click an icon to log in:

WordPress.com logo

Je reageert onder je WordPress.com account. Log Out / Bijwerken )

Twitter-afbeelding

Je reageert onder je Twitter account. Log Out / Bijwerken )

Facebook foto

Je reageert onder je Facebook account. Log Out / Bijwerken )

Verbinden met %s


Follow

Get every new post delivered to your Inbox.