Today’s full of surprises for me… The simple code below isn’t working. It never enters the block in the if statement even though the NSLog shows the title property as matching that if condition. I’m going crazy today….
-(void)alertView:(UIAlertView *)alertView willDismissWithButtonIndex:(NSInteger)buttonIndex
{
NSLog(@"%@", alertView.title);
if (alertView.title == @"Warehouse") {
//.... never get in here even though NSLog above returns "Warehouse"
EDIT:
I figured it out. Answering this here in case it’ll help anyone else.
Apparently iOS 6 is stricter with comparing strings or something. The == used to work fine in iOS 5 but in iOS 6 I had to use
if ([alertView.title isEqualToString:@"Warehouse"]) {
then it works fine.
Your are doing it correctly but there is a small problem –
The proper Code will be –
Now it will work for you.