模态视图不是专门的某个类,而是通过视图控制器的presentViewController方法弹出的视图,我们称为模态视图。
1.显示窗口
- (IBAction)showModalView:(id)sender
{
ModalViewController *modalView = [[ModalViewController alloc] init];
modalView.modalTransitionStyle = UIModalTransitionStyleCoverVertical;//添加动画
[self presentViewController:modalView animated:YES completion:^{
NSLog(@"回调机制");
}];
}
2.关闭窗口
- (IBAction)closeWindow:(id)sender
{
[self dismissViewControllerAnimated:YES completion:^{
NSLog(@"model view close");
}];
}
原文:http://www.cnblogs.com/suenihy/p/3513611.html