0

我有一个基于标签的应用程序。该应用程序使用 FirstViewCOntroller 启动。我想在单击相同的选项卡项第一个视图时显示模态视图。

我正在尝试在选项卡栏的 didSelectViewController 方法中的应用程序委托中添加代码,但是由于无法识别的选择器被发送到实例,因此出现错误。此外,警告显示为未找到 presentViewController 方法。

我正在添加代码。方法:

ModalViewController *modalView = [[ModalViewController alloc] initWithNibName:@"ModalViewController" bundle:nil];
    modalView.modalPresentationStyle = UIModalPresentationFullScreen;
    [self presentViewController:modalView animated:NO completion:NULL];

    [modalView release];

请帮忙。

提前致谢

4

1 回答 1

0

PresentViewController是在类中定义的方法viewcontroller,因此您必须从Viewcontroller类中调用它。由于您已经在应用程序委托中编写了此代码,其中 self 不是viewcontroller.

所以我建议你使用FirstViewcontroller类来执行这段代码

于 2013-01-24T02:19:38.137 回答