Ive got a little codesnippet where Im trying to compare a string with another.
Even though writing out the myTitle-variable in the alertbox will in fact display the string ("HELLO") that Im comparing it with (tried it by removing the if-statement and just executing the alert-box), the if-statement wont equate myTitle to the string.
Is this due to some inconsistency between datatypes, perhaps? I mean, they are both strings, arent they, and thus should be comparable?
Even though writing out the myTitle-variable in the alertbox will in fact display the string ("HELLO") that Im comparing it with (tried it by removing the if-statement and just executing the alert-box), the if-statement wont equate myTitle to the string.
Is this due to some inconsistency between datatypes, perhaps? I mean, they are both strings, arent they, and thus should be comparable?
Code:
NSString *myTitle = level2ViewController.title;
if(myTitle == @"HELLO")
{
// Display alert
UIAlertView *myAlert = [[UIAlertView alloc] initWithTitle:@"Title:" message:myTitle delegate:self cancelButtonTitle:nil otherButtonTitles:@"OK", nil];
[myAlert show];
[myAlert release];
}