UIAlertView在传递另一个视图时延迟或不显示。任何帮助将不胜感激。
-(void)viewDidLoad{
levelContentController = [[UIAlertView alloc] initWithTitle:@""
message:@"Loading...
delegate:self
cancelButtonTitle:nil
otherButtonTitles:nil];
}
-(void)passToTestView:(id)sender{
[levelContentController show];
ViewController *viewController = [[ViewController alloc]init];
clickedLevelId = [[NSString alloc] init];
clickedLevelId = [testIdStringArray objectAtIndex:[sender tag]-1];
[viewController sendIndexMethod:sendIndex];
[viewController testCompletedArrayMethod:arrayOfCompletedTest];
[viewController parseTestURL:buttonTag getTestIdString:clickedLevelId];
viewController.viewSoundCheck = _levelSoundCheck;
[self presentViewController:viewController animated:YES completion:nil];
}
-(void)viewWillDisappear:(BOOL)animated{
[levelContentController dismissWithClickedButtonIndex:0 animated:YES];
}
答案 0 :(得分:2)
以上代码存在一些问题。
调用viewWillDisappear:
选择器时,它会尝试显示alertView。但在同一方法中,您尝试呈现另一个视图控制器。
这将依次调用ViewController
隐藏alertView。
如果您希望在显示UIAlertView
时显示alertView,请在ViewController
班级viewDidLoad
或viewWillAppear:
中创建并显示 $data = $_POST['carData'];
$params = [];
$updateString = "";
foreach ($data as $key => $value)
{
if($key != "id")$updateString .= $key." = :".$key.",";
$params[':'.$key] = $value;
}
$updateString = rtrim($updateString, ","); //remove last ,
$stmt = $pdo->prepare("UPDATE cars SET ".$updateString." WHERE id = :id");
$stmt->execute($params);
个实例。不要在此viewController中初始化并显示它。
答案 1 :(得分:0)
要显示UIAlertView,您应该致电:
[contentLoadingController show];
请注意,iOS9中不推荐使用UIAlertView,您应该使用UIAlertController。