I created a Alertview with login and password field. If the user entered the wrong password I show another Alertview telling him to try again.
I would like to use the same code for both Alertviews. Everything works fine if I am using just one title to compare.
What is wrong with this :
- (void) alertView:(UIAlertView *) actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex{
if ([[actionSheet.title compare:@"Enter your login data"] == NSOrderedSame] ||
[[actionSheet.title compare:@"Auth Error - Try again"] == NSOrderedSame])
{
// Do something
Basically: In both cases ( both titles ) I would like to do the same.
you can set same integer value for
tagproperty for both the alert view and you can work with that.e.g.
if you still want to compare the titles you can use
- (BOOL)isEqualToString:(NSString *)aStringmethod ofNSStringit will return success based on the comparison.e.g.
HTH.