前言:时间忙,先把这个记下 ,有空再来补充。
- present一个ViewController
LHQDoorController *lagerPicVC = [[LHQDoorController alloc]init];
self.definesPresentationContext = YES;
lagerPicVC.modalPresentationStyle = UIModalPresentationOverCurrentContext;//关键语句,必须有 ios8 later
// 动画关闭 不然会有个半透明背景跟着动画 很丑..
[self presentViewController:lagerPicVC animated:NO completion:^{
// 根据 colorWithAlphaComponent:设置透明度,如果直接使用alpha属性设置,会出现Vc里面的子视图也透明.
lagerPicVC.view.backgroundColor = [[UIColor whiteColor] colorWithAlphaComponent:0.5];
}];
- present 一个NavController
LHQDoorController *lagerPicVC = [[LHQDoorController alloc]init];
lagerPicVC.view.backgroundColor = [[UIColor whiteColor] colorWithAlphaComponent:0.9f];
NavController *doorNav = [[NavController alloc]initWithRootViewController:lagerPicVC];
doorNav.view.backgroundColor = [UIColor clearColor];
// self.definesPresentationContext = YES;
doorNav.modalPresentationStyle = UIModalPresentationOverCurrentContext;//关键语句,必须有
[self presentViewController:doorNav animated:NO completion:^{
}];
网友评论