tags:

views:

825

answers:

2

Sorry for the simple question but I feel like there's a smarter way to do this:

if ([txtFldTo.text length]>0){ 
    //do something
}
else {
    //do something else
}

where txtFldTo is an IBOutlet UITextField connected to a text field on the interface.

+3  A: 

Something like this should suffice.

if([[textfield text] length] > 0)

Ryan Townshend
That was my guess, I just thought there was a better way; e.g., !=@"", or or simply not textfield.text.
Greg
+3  A: 

You're doing it right.

Chris Lundie