解除tableViewController提供的ModalView? [英] Dismiss ModalView that was presented by tableViewController?

查看:84
本文介绍了解除tableViewController提供的ModalView?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的项目中应用程序在ViewController中启动,它通过将其作为子视图添加到表(Table类)中(ViewController.h - [self.view addSubview:Table.tableView];)

In my project the app launches in ViewController, which loads inside a table (Table class) by adding it as a subview (ViewController.h - [self.view addSubview: Table.tableView];)

Camera Class是详细视图,因此当您点击表格行时,它会加载Camara.xib。直到这里一切正常。

Camera Class is the detailed view, so when you tap in a table row it loads Camara.xib. Until here everything works fine.

当我尝试解散Camera.xib并返回ViewController.xib时出现问题,当我这样做时,Camera.xib解除了,但是该应用程序仅加载Table.xib,而不是返回ViewController.xib,其中包含Table.xib,因此放置在ViewController.xib视图中的其余对象不会显示。

The problem comes when I try to dismiss Camera.xib and go back to ViewController.xib, when I do that Camera.xib dismisses okay but instead of going back to ViewController.xib with Table.xib inside of it, the app only loads Table.xib, so the rest of objects that were placed in the view of ViewController.xib are not displaying.

我做错了什么?

提前致谢!!

CODE :

Table.m

- (void)viewDidLoad
{

    roomsArray = [[NSMutableArray alloc] initWithObjects:nil];
    [super viewDidLoad];

}


- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    // my code...

    Camara *camara = [[Camara alloc] initWithNibName:@"Camara" bundle:nil];
    [self presentViewController:camara animated:YES completion:nil];

}

Camara.m

-(IBAction)cancel:(id)sender {
    [self dismissViewControllerAnimated:YES completion:nil];
}

ViewController.m

ViewController.m

- (void)viewDidLoad
{

    table = [[Table alloc] initWithNibName:@"Table" bundle:nil];

    [windows.tableView reloadData];
    [self.view addSubview:windows.tableView];
    windows.tableView.transform = CGAffineTransformMakeTranslation(0, 44);

    [super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.

}

推荐答案

问题是tableViewController和ViewController在两个视图控制器中,所以我将它们组合起来,现在一切正常。

the problem was that tableViewController and ViewController were in two view controllers, so I Combined them and now all works fine.

这篇关于解除tableViewController提供的ModalView?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆