I have a methods that clears all my UITextFields
in the UIViewController
.
I have a lot of methods that trigger that function before taking place. I want to ask the user using an UIAlertView
if it's ok to clear fields before the action is taking place.
I'm aware of alertView:clickedButtonAtIndex:
but don't really want to use it because my switch will look like this:
- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
{
if(alertView.tag == 2000)
{
if (buttonIndex == 0)
{
// do stuff
}
else if (buttonIndex == 1)
{
// do stuff
}
}
if(alertView.tag == 3000)
{
if (buttonIndex == 0)
{
// do stuff
}
else if (buttonIndex == 1)
{
// do stuff
}
}
etc..
I'm searching for an elegant way to trigger the same UIAlertView
before every function that needs to clear the screen before it's triggered.
Thanks