Goodevening
在IOS6.0中,dismissModalViewControllerAnimated :( BOOL)已弃用。可悲的是,我在互联网上找不到任何其他解决方案。有人有什么强硬吗?我有一个方法的关键按钮。在那种方法中,应该关闭模态视图。
制作按钮:
UIButton *closeBtn = [[UIButton alloc] initWithFrame:CGRectMake(200, 200, 50, 50)];
closeBtn.backgroundColor = [UIColor purpleColor];
[closeBtn addTarget:self action:@selector(closeModalView:) forControlEvents:UIControlEventTouchUpInside];
[self addSubview:closeBtn];
方法:
- (void)closeModalView:(id)sender{
//This is deprecated
[self dismissModalViewControllerAnimated:YES];
}
提前谢谢!
答案 0 :(得分:4)
新方法:
[self dismissViewControllerAnimated:YES completion:nil];
答案 1 :(得分:1)
使用[self dismissViewControllerAnimated:YES completion:nil
Apple替换了该方法,因此您可以在视图被解除后执行显示警报视图等操作:
[self dismissViewControllerAnimated:YES completion:^{
[[[UIAlertView alloc] initWithTitle:..] show];
}];