Completed Application Doesn't Generate Number in the Window


#1

I think I may be missing something.

I created the application just as it was spelled out in the book.

However, when I run the application, the random number is generated in the console, but not the application. How do I get the generated number to display in the application (i.e. in the ‘Label’)?

Thanks.


#2

I don’t think so, otherwise it would work correctly :wink: But nevertheless it is little information you gave us, so
it is only possible to guess. Maybe you forget to bind the RandomControllers ivar (textField) to the “Label” of
the window (s. page 23 at the bottom). If this is not the problem, I would check the application step by step again, it
shouldn’t be a big deal, because of little code.

cu
Vertex


#3

As Vertex points out, I suspect that you forgot to bind the RandomController’s textField outlet to the label. If you put a breakpoint in generate:, what is the value of textField when it is sent the message “setIntValue:”?


#4

Double check that you’ve set the output connection from the object to the label.

Take a look in Xcode at the line number. To the left of the line that implements the method you should see a little circle. If it’s filled in there is a connection somewhere and clicking on it will show you what it is. If the circle is empty then you need to make the connection still.