I show UIAlertView
with UIAlertViewStylePlainTextInput
style. Then I try to validate for empty field like this:
-(void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex{
if (buttonIndex == 1) {
if ([[alertView textFieldAtIndex:0].text length] > 0 ||
[alertView textFieldAtIndex:0].text != nil ||
[[alertView textFieldAtIndex:0].text isEqual:@""] == FALSE)
{
NSLog(@"error");
}
else
{
[self postToServer];
}
} else {
//close alertview
}
}
But it shows me an error message in log even if textfield not empty.