StaticText Label


#1

Hello
I’ve done the “Challenge” exercise on page 96. My problem was that the text “Label” from the staticText Label was always shown. That means that the concatenated text with the number of characters was overlaid to “Label”. I’ve solved the problem by clear the field “Title” in attribute editor of the StaticText Label. I also use the method “awakeFromNib”.

How would solve an advanced programmer this issue? Is there a more elegant way to do this?

Another question is about the main function. When is main created automatically? In my application I can not find e file called “main”. Where is he main?

Regards

brunjak


#2

The main function main () lives in the file main.m. This file is created by Xcode, and it should be in the group Supporting Files in the in the Project Navigator.

As for the static text label, there is no need to clear its title in Interface Builder (IB). Just assign a new text to it; the existing text is replaced by the new text.

textField.stringValue = @"Triple J FM 105.5";

Just make sure (in IB) that the width of the text field is large enough to accommodate your text.


#3

Hello

Thank you for your response. The problem with the static text label was the with!

Thank you

brunjak