UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Congratulations" message:message delegate:self cancelButtonTitle:@"Cancel" otherButtonTitles:@"View", nil];
UIImageView *imageView = [[UIImageView alloc] initWithFrame:CGRectMake(110, 100, 80, 80)];
NSString *imagePath = [NSString stringWithFormat:@"%@", [Array objectAtIndex:x]];
UIImage *bkgImg = [UIImage imageWithContentsOfFile: [[NSBundle mainBundle] pathForResource:imagePath ofType:@"png"]];
imageView.image = bkgImg;
[bkgImg release];
[alert addSubview:imageView];
[imageView release];
[alert show];
[alert release];
这就是我用来创建警报视图的代码。目前,我已经设置好了,所以如果用户按下其中一个按钮,它将加载一个新的视图控制器。在我向 UIAlertView 添加子视图之前,它工作正常。现在,每当它动画到新屏幕时,它只会使程序崩溃。我对 iPhone 开发相当陌生,任何帮助将不胜感激。