从标签栏应用程序显示模态视图控制器 [英] Showing a modal view controller from a tab bar app

查看:145
本文介绍了从标签栏应用程序显示模态视图控制器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

首先,我想提醒一下,我是iPhone编码的完全新手...

First, I would like to warn that I am a complete newbie into iPhone coding...

我需要从库中显示一个viewcontroller,我知道这是模态的。我有一个标签栏应用程序(使用默认的XCode模板创建)。我需要显示viewcontroller,如果它隐藏tabbar本身没有问题...但我很无能,我甚至不知道要搜索什么,或者读什么......

I need to show up a viewcontroller from a library, I know that it is modal. I have a tab bar app (created with the default XCode template). I need to show that viewcontroller, there are no problem if it hides the tabbar itself... But I am quite clueless, I don't know even what to search, or what to read...

推荐答案

您可以致电 presentModalViewController:animated:以模式方式显示另一个 UIViewController

You can call presentModalViewController:animated: to display another UIViewController modally.

编辑:如果要显示模态视图以响应按钮触摸(例如),您将显示如下:

If you want to display your modal view in response to a button touch (for example), you would display it like this:

- (IBAction)buttonTouched:(id)sender
{
    ModalViewController* controller = [[ModalViewController alloc] init];
    [self presentModalViewController:controller animated:YES];
    [controller release];
}

然后当你要解雇模态控制器时,请致电 dismissModalViewControllerAnimated:。这可以在主视图控制器或模态控制器上调用。

Then when you want to dismiss the modal controller, call dismissModalViewControllerAnimated:. This can be called either on your main view controller, or the modal one.

这篇关于从标签栏应用程序显示模态视图控制器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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