In the alertView delegate, theres a method:
-(void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex;
My question is, how can I find which AlertView called this delegate.
For example, I have a couple alert views which all use the delegate, but depending on which alertview called this method, I want to set up different actions for buttonIndex's.
The "alertView" object that is being passed into the method is the actual alert that is being used in the method. The most straightforward way is to provide logic inside this method that looks at the alertView object (maybe looking at the name or tag? It's up to you), and then provides different actions for each.
-(void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
{
if (alertView.tag == 1)
{
// do something
}
else if (alertView.tag == 2)
{
// do something else
}
// continue for each alertView
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With