转载自http://blog.csdn.net/liuhongwei123888/article/details/42001277/
- //源Controller中跳转方法实现
- MKDialogController *controller = [[MKDialogController alloc] init];
- controller.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;
- if ([[UIDevice currentDevice].systemVersion floatValue] >= 8.0) {
- controller.providesPresentationContextTransitionStyle = YES;
- controller.definesPresentationContext = YES;
- controller.modalPresentationStyle = UIModalPresentationOverCurrentContext;
- [self presentViewController:controller animated:YES completion:nil];
- } else {
- self.view.window.rootViewController.modalPresentationStyle = UIModalPresentationCurrentContext;
- [self presentViewController:controller animated:NO completion:nil];
- self.view.window.rootViewController.modalPresentationStyle = UIModalPresentationFullScreen;
- }
- self.view.backgroundColor = [UIColor clearColor];
- UIView *alphaView = [[UIView alloc] initWithFrame:self.view.frame];
- UIView *baseView = [[UIView alloc] initWithFrame:self.view.frame];
- alphaView.backgroundColor = [UIColor clearColor];
- baseView.backgroundColor = [UIColor blackColor];
- baseView.alpha = 0.7;
- [self.view addSubview:baseView];