ios – 呈现多个视图控制器?

更新:
我再次面临这个问题,并找到另一种方式.如果演示控制器没有嵌入到导航控制器中,如果控制器不是全屏显示,它将被隐藏,并且会变黑.方法setModalPresentationStyle:UIModalPresentationCurrentContext只能应用于导航控制器.因此,在UINavigationController中嵌入呈现控制器,将UIModalPresentationCurrentContext设置为新的控制器 – 您将获得对话控制器.

我正在展示搜索控制器,它具有推送堆栈详细控制器的tableView.

详细的控制器可以显示带有消息的视图控制器,它由小的UIView和半透明背景组成.

问题:当最后一个视图控制器出现时,它下面的所有视图控制器变得隐藏,并且显示搜索控制器的控制器变得可见.

在这里我在做什么

SearchViewController *viewController = [[SearchViewController alloc] initWithNibName:@"SearchViewController" bundle:nil];
viewController.data = dataArray;

UINavigationController *navigationController = [[UINavigationController alloc] initWithRootViewController:viewController];
[self.navigationController setModalPresentationStyle:UIModalPresentationCurrentContext];
[self.navigationController presentViewController:navigationController animated:YES completion:nil];

比表推动详细视图:

DetailViewController *viewController = [[DetailViewController alloc] initWithNibName:@"DetailViewController" bundle:nil];
[viewController setHidesBottomBarWhenPushed:YES];
viewController.dataItem = [data objectAtIndex:(NSUInteger) [indexPath row]];
[self.navigationController pushViewController:viewController animated:YES];

和详细视图介绍消息框:

MessageController *controller = [[MessageController alloc] initWithNibName:@"MessageController" bundle:nil];
controller.message = message;
[self presentViewController:controller animated:YES completion:nil];

当它被解雇时,其下的所有控制器变得可见.

更新:

所有我想要的是以模态的方式呈现一个视图控制器,它将具有可视性.从这个表中可以看到详细的视图,可以显示消息框.消息框必须是另一个视图控制器.当显示消息框时,所有两个前面的控制器消失.这是问题.

解决方法

The trivial way to attempt to achieve that is to just create the VCs
you want to present modally and present one after the other.
Unfortunately,this is not gonna work. What you get is just the first
VC presented,all others just go Nowhere. UIKit just won’t cooperate
with you here.

http://xissburg.com/presenting-multiple-modal-view-controllers-at-once/

UIGraphicsBeginImageContextWithOptions(self.view.bounds.size,NO,0);
CGContextRef context = UIGraphicsGetCurrentContext();
[self.view.layer renderInContext:context];
UIImage *image = UIGraphicsGetimageFromCurrentimageContext();
UIGraphicsEndImageContext();

相关文章

UITabBarController 是 iOS 中用于管理和显示选项卡界面的一...
UITableView的重用机制避免了频繁创建和销毁单元格的开销,使...
Objective-C中,类的实例变量(instance variables)和属性(...
从内存管理的角度来看,block可以作为方法的传入参数是因为b...
WKWebView 是 iOS 开发中用于显示网页内容的组件,它是在 iO...
OC中常用的多线程编程技术: 1. NSThread NSThread是Objecti...