[Mono-osx] 3 cross-platform questions

Andreas Färber andreas.faerber at web.de
Wed Feb 25 16:36:33 EST 2009

Am 25.02.2009 um 01:58 schrieb Mac Programmer:

> (2) Is there a way to create a Cocoa app in Mono without using
> a .nib?

Yes, there is. If your application calls the default  
NSApplicationMain(argc, argv), then it tries to load a .nib, as  
documented by Apple. If instead you call a subset of the Objective-C  
methods involved directly, you don't need one. E.g.:

int main(int argc, char* argv[]) {
     [YourApplication sharedApplication]; // create instance, assign  
to NSApp
     [NSApp run];
     return 0;
     // vs. return NSApplicationMain(argc, (const char**)argv);

The advantage is that it makes incremental localization easier for me,  
I can load sensibly named strings from .strings files and adapt sizes  
instead of having to localize a whole .nib file. The disadvantages are  
setting up some of the Cocoa controls is more complicated than  
clicking them together in Interface Builder, with little documentation  
available since uncommon, and deserializing a .nib archive to memory  
may be more performant than doing sequential initializations from code.

An MVC design and the use of a graphical interface designer tool are  
orthogonal to each other imo.


More information about the Mono-osx mailing list