views:

1413

answers:

3

Hey guys, I am making a simple Twitter update application using MGTwitterEngine

and I can't seem to get the TextField in Interface Builder to clear the text after they click the "update" button. Is there an easy method that I could do this with or something in Interface Builder?

Thanks a lot!

+5  A: 
IBOutlet NSTextField *textField;

[textField setStringValue:@""];
[textField display];
andi
+4  A: 

Be aware that it probably isn't when the button is pressed that the NSTextField is cleared, but when the tweet is uploaded.

Else you risk losing the tweet if it couldn't be sent for some reason.

[Not a solution to the direct question, but a solution to follow-up problem...]

Matthew Schinckel
+4  A: 

I think you also need to define a IBAction method like:

- (IBAction) clearText:(id) sender {
    [textField setStringValue:@""];
    [textField display];
}

You can now assign a button event (e.g. button down) to this action.

Koraktor
I assumed that he already has an action since he has an "Update" button. That's why I only added the outlet.
andi