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

nashyo

macrumors 6502
Original poster
Oct 1, 2010
299
0
Bristol
Hi,

For clearing the text property of a UITextField programmatically, is it best to write nameTextField.text = @""; or nameTextField.text = nil; //?

I'm not sure if this is the reason why my app is not working properly. I'm still trying to debug.

I've searched through the apple documentation and other forums, and there doesn't seem to be a straight answer anywhere.

Thanks
Rob
 
The documentation says that the text property is a NSString and is nil by default. I have used the empty quote method on NSStrings in UILabels and don't know why it wouldn't work with a UITextField also. So, it seems both methods are fine.
 
The documentation says that the text property is a NSString and is nil by default. I have used the empty quote method on NSStrings in UILabels and don't know why it wouldn't work with a UITextField also. So, it seems both methods are fine.

Thanks for this.

I don't have a problem with UILabels either. It's only the UITextFields that seem to cause a problem. I'll look into it.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.