I ran in to problems tonight testing to see if there was a string in a textField. Can you test to see if the textField is empty or do you need to copy the value in to an NSString first to test it? Even with the textField Empty it evaluates to TRUE and executes the if statement.
Code:
-(void)closeEntry{
NSLog(@"The amount TextField: %@", amountTextField.text); // test
[COLOR="Red"] if (![amountTextField.text isEqualToString:@""]) [/COLOR]{
entryAmount = [amountTextField.text floatValue];
NSString *floatConversion = [NSString stringWithFormat:@"$ %@.02f", entryAmount];
entryString = workTypeTextField.text;
NSDictionary *tempDict = [[NSDictionary alloc] initWithObjectsAndKeys:floatConversion,@"entryAmount",entryString,@"entryDiscription", nil];
[tableViewArray addObject:tempDict];
NSLog(@"TabelViewArray %@", tableViewArray);
totalIncome = 0.0;
for (int i = 0; i < [tableViewArray count]; i++) {
NSMutableDictionary *tempIncomeDict = [[NSMutableDictionary alloc] initWithDictionary:[tableViewArray objectAtIndex:i]];
NSLog(@"TempIncomeDict %@", tempIncomeDict);
NSString *tempString = [NSString stringWithFormat:@"%@", [tempIncomeDict objectForKey:@"entryAmount"]];
totalIncome = totalIncome + [tempString floatValue];
}
total.text = [NSString stringWithFormat:@"%.02f",totalIncome];
[self.tableView reloadData];
}
[enteryView removeFromSuperview];
}