My motivation to do this is because I want to make my non-standard window enter fullscreen (although now I now this is not the way of doing it) it was interesting. So in OSX 10.6 and earlier
NSWindow
has: performZoom:
, performMiniaturize:
, performClose:
, etc. So I thought there should be something like:performFullscreen:
No?
I dug into 10.7 SDK documentation hoping to find something. Unfortunately no, there seems to be no new things in
NSWindow
?, at least not that I have noticed. Weird... Maybe I am not looking at the correct docs? I just thought of this:
#import <objc/runtime.h> unsigned int methodCount = 0; Method *mlist = class_copyMethodList([NSWindow class], &methodCount); for (int i = 0; i < methodCount; ++i){ NSLog(@"%@", NSStringFromSelector(method_getName(mlist[i]))); }which will print a list of all methods implemented by
NSWindow
and it worked! I got the whole list. Including the private methods :)
These Objective-C runtime functions must be the Swiss knife of cocoa-hackers. I still have to try this in 10.7 but This is definitely a good start.
PS: Off-course there was no
performFullscreen:
method. Later I realized that toggleFullScreen:
will do the job :)
0 comments :
Post a Comment