PDA

View Full Version : How to correctly wire up an interface?




zorro2b
Jun 18, 2008, 10:18 PM
I have tried a couple of tutorials on the web. I am using XCode 3.1. This is the latest one I have tried:
http://www.cocoadevcentral.com/d/learn_cocoa_two/

Now I got to the end of the tutorial, but the application does not clear the textview as expected. I have run it under the debugger and the clearText method on the AppController is actually being called when I click the clear button. However the [textView setString: @" "]; does not do anything.

I have downloaded the completed example from the site above, and while theirs works I can't see any obvious difference.

The AppController has a clearText action and a textView outlet.

Any suggestions on how I can work out what is wrong?



lucasgladding
Jun 18, 2008, 11:00 PM
Try setting a breakpoint in your setString: method and check to make sure the NSTextView is being recognized by the controller. Make sure that your outlet is linked to the view before doing anything else.

When things don't behave when you think they should, checking with the debugger for nil variables is a good first step.

Best of luck

zorro2b
Jun 19, 2008, 04:51 AM
Try setting a breakpoint in your setString: method and check to make sure the NSTextView is being recognized by the controller. Make sure that your outlet is linked to the view before doing anything else.

When things don't behave when you think they should, checking with the debugger for nil variables is a good first step.

Best of luck

I figured it out. I had linked the outlet to the bordered scroll view instead of the text view that it enclosed.

Also, is it possible in the debugger to inspect the object to determine what methods it has defined?