How can I cancel a UIAlertView programmatically?
This is the code that I use to show the UIAlertView
UIAlertView *myAlertView = [[UIAlertView alloc] initWithTitle:@"Save Background" message:@"Downloading..." delegate:self cancelButtonTitle:@"Cancel" otherButtonTitles:nil, nil];
    CGAffineTransform myTransform = CGAffineTransformMakeTranslation(0.0, 70.0);
    [myAlertView setTransform:myTransform];
    [myAlertView show];
Try to use dismissWithClickedButtonIndex: like this:
Here is the code to use:
[myAlertView dismissWithClickedButtonIndex:-1 animated:YES];
You could do it via
- (void)dismissWithClickedButtonIndex:(NSInteger)buttonIndex animated:(BOOL)animated
while calling the "cancel" button index.
You could also simply remove the alert view from the superview (i.e. "removeFromSuperview").  Make sure to "release" the alloc'd view in case you are not using ARC.
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