[Mono-osx] Stetic GUI designer for Mac OS?

Joanna Carter cocoasharp at carterconsulting.org.uk
Wed Mar 3 15:39:24 EST 2010


Hi Ralf

> I think, I'm not be able to find any mistakes:-)

You'd be surprised how many mistakes a total newbie found during the proofreading. My problem, in writing such tutorials, is over-familiarity, leading to not including solmething I don't think twice about doing :-)

> I think the best way, to do it right, is to learn Objective-C. I hope it is
> not that hard;-)

Quick tutorial:

Objective-C is a dynamic language - you don't call methods, you send messages to objects, which may or may not contain a method that will respond.

The compiler will only warn you if you send a message that is not declared on the object, because it is possible to have a delegate object assigned to the target object to handle certain methods.

You can send a message to a nil object, it will not AV, just fail silently.

Typical method syntax :-

- (void) initWithValue:(id)value inContext:(NSManagedObjectContext *)context;

- = this is an instance method, class (static) methods start with +

(void) = return type

initWithValue:inContext: = the name of the method as you are likely to see it in documentation, each colon denotes that there is a parameter at that position in the name.

(id)value = the parameter for the first part of the method name

(NSManagedObjectContext *)context = the parameter for the second part of the method name

You will notice that the method name is split after each parameter. This can make the code more readable because it "attaches" the parameter to the part of the name it relates to, rather than having to figure out which parameter is which in a long list after the whole name.

Whilst you are learning, always switch on Garbage Collection - the instructions are in the tutorial. Later, or when you want to program for iPhone, you can get the hang of reference counting, which is the default memory model.

> Something off topic:
> Is there a keyboard shortcut for moving the cursor to the beginning (Pos 1
> on Windows keyboard) or the end (End on Win keyboard) of line? Scrolling
> through a long line of text with the right/left key is really boring:-)

Cmd(Apple)-left = to beginning of line
Cmd(Apple)-right = to end of line
Cmd(Apple)-up = to beginning of file
Cmd(Apple)-left = to end of file

Alt(Option)-left = previous wordbreak
Alt(Option)-right = next wordbreak

Use Shift as well for extending selected text.

Use Alt(Option) with the mouse to select rectangular blocks.

Oh, and Esc for code completion/insight (context sensitive).

The Xcode help is really excellent, simply type in "Keyboard" into the search for the Xcode documentation for more.

You may like to contact me off-line rather than continue this in a Mono list - simply replace "cocoasharp" in my email with "joanna" and I will know it's not from the list.

Joanna

--
Joanna Carter
Carter Consulting



More information about the Mono-osx mailing list