Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Mac Me Up

macrumors regular
Original poster
Jun 25, 2005
170
0
Australia
Ok, so I'm a seasoned developer, just not a Cocoa one. I have a UITextField in a view defined in a xib. I've linked the view up with my controller and I can put buttons on there and call actions just fine. How do I access controls like text fields though so I can set and get text? I've tried all sorts of things with no luck...

I've googled it as well but I just can't figure out something that is no doubt really simple?
 

detz

macrumors 65816
Jun 29, 2007
1,051
0
In you header file for you Delegate.

IBOutlet UILabel *labelName;

Then, *Control* click on the Delegate class in IB and drag a connection from the labelName to the label.

....later


[labelName setText:mad:"testing"];
 

Mac Me Up

macrumors regular
Original poster
Jun 25, 2005
170
0
Australia
OK so in my interface I set up:
IBOutlet UITextField *txtName;

Then I control click from my delegate and set txtName to be the outlet for the text field. That all works fine. However when I make a call to:
[txtName setText:mad:"Testing"];
the text fields stays blank. The code is definitely being called, but on the screen nothing happens. I tried a call to setNeedsDisplay, but that didn't seem to do anything. I must be missing something really simple here?
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.