- (IBAction)addButtonPressed:(id)sender
{
if ([textField.text length]==0)
{
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"Information",@"") message:NSLocalizedString(@"Txt is Empty!",@"") delegate:nil cancelButtonTitle:NSLocalizedString(@"OK",@"") otherButtonTitles:nil];
[alert show]; alert = nil;
}
else
{
// Code to add textField's value to Array.
}
}
First check that how many times you call IBAction
method when Button tapped???
Other wise put instance of UIAlertView
is a public.. I mean put in .h file
and access it as self.yourAlertViewName
in .m file
.
Thanks :)