如果有什么不对劲的地方请见谅……第一次发帖。
我已经看到了一些与此类似的问题,但没有一个具有相同的问题。我正在运行 IOS 6.1 和 Xcode 4.6。问题是不会调用 didDismiss,只会调用 willDismiss。我的代码与日志输出一起在下面。有任何想法吗?
#import "MenkLabUIAlertTestViewController.h"
@interface MenkLabUIAlertTestViewController ()
@end
@implementation MenkLabUIAlertTestViewController
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
// Custom initialization
}
return self;
}
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view.
}
- (IBAction)test:(id)sender {
UIAlertView *av = [[UIAlertView alloc] initWithTitle:@"Encrypting File(s)" message:@"Please wait..." delegate:self cancelButtonTitle:nil otherButtonTitles:nil, nil];
// UIActivityIndicatorView *indicator = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhiteLarge];
[av show];
[av dismissWithClickedButtonIndex:-1 animated:YES];
}
- (void) alertView:(UIAlertView *)alertView willDismissWithButtonIndex:(NSInteger)buttonIndex {
NSLog(@"willDISMIS");
}
- (void) alertView:(UIAlertView *)alertView didDismissWithButtonIndex:(NSInteger)buttonIndex {
NSLog(@"didDISMIS");
}
- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
@end
日志输出:
2013-07-08 17:27:04.055 testUIAlertView[10534:11303] willDISMIS
这只是一个测试应用程序,但是,它与我当前应用程序中存在的问题完全相同。
先谢谢了。一整天都在为此绞尽脑汁!