Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/115.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios 将视图控制器置于前面_Ios_Uiviewcontroller_Containment_Uimodalpresentationstyle - Fatal编程技术网

Ios 将视图控制器置于前面

Ios 将视图控制器置于前面,ios,uiviewcontroller,containment,uimodalpresentationstyle,Ios,Uiviewcontroller,Containment,Uimodalpresentationstyle,目前,我的iPhone应用程序中同时有三个视图控制器 我用的是一个 这是我的照片: 当我点击表格视图单元格时,我想打开一个新的视图控制器,如下所示: (鸡蛋代表一个新的视图控制器 但正如你们所看到的,我的橙色视图控制器在前面 我如何改变这个 我用来打开鸡蛋视图控制器的代码: - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { UIViewContro

目前,我的iPhone应用程序中同时有三个视图控制器
我用的是一个

这是我的照片:

当我点击表格视图单元格时,我想打开一个新的视图控制器,如下所示:

(鸡蛋代表一个新的视图控制器

但正如你们所看到的,我的橙色视图控制器在前面

我如何改变这个

我用来打开鸡蛋视图控制器的代码:

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    UIViewController *boxView = [self.storyboard instantiateViewControllerWithIdentifier:@"BoxView"];
    boxView.modalPresentationStyle = UIModalPresentationFormSheet;
    boxView.modalTransitionStyle = UIModalTransitionStyleCoverVertical;
    boxView.view.frame=CGRectMake(-50, 5, 300, 470);
    [self.view addSubview:boxView.view];
    //[self.view bringSubviewToFront:boxView];

}

这应该很容易,您需要您的父视图控制器(即橙色控制器)来添加新视图控制器的子视图。您通常可以通过
[self.parentViewController addSubview:boxView.view]
来完成。但是,由于您使用的是ECSlidingViewController,您可以这样做:
[self.slidingViewController.topViewController.view addSubview:boxView.view]


当然,您需要相应地调整新ViewController的框架。

没问题,Mark!为了能够关闭,我现在想到的是,您需要在视图中添加一个按钮/点击手势,当您单击/触摸它时,您将触发[self.boxView.view removeFromSuperView]。我建议您声明新的视图控制器(即boxView控制器)作为属性,例如@property(强,非原子)UIViewController*boxView,因为您希望像self.boxView一样访问它