Thursday, 7 March 2013

UIAlertView delegate to perform specific actions on button click of Alert Box




- (void)alertView:(UIAlertView *)alertView
clickedButtonAtIndex:(NSInteger)buttonIndex
{
    if (buttonIndex == alertView.cancelButtonIndex)
    {
        // cancel clicked ...do your action
    }
    else if (buttonIndex == 1)
    {
      // 1st button  clicked ...do your action
    }
     else if (buttonIndex == 2)
    {
      // 2nd button  clicked ...do your action
    }
}
// remember to add uialertViewDelegate