iPhone 工具栏显示视图

发布于 2024-12-17 00:28:04 字数 413 浏览 2 评论 0原文

好的,我找不到 UIViewController 调用的呈现新视图的方法。

我有一个基于 UINavigationController 的应用程序。一旦我看到显示对象详细信息的视图,底部就会有 1 个工具栏,这样我就可以为用户提供一些选项。 当他按下 barButtomItem 时,我想显示一个新视图,但不更改导航栏,所以如果我按后退按钮,他会从详细视图返回,而不是从新选项返回。

我知道方法 PushViewController 但不能按我想要的方式工作。

提前谢谢!

编辑:如果我打电话的话,只是为了更清楚 [[self navigationController]pushViewController:loteCompraViewController 动画:YES]; 我得到一个与新控制器相关的新视图,但它也更改了导航栏,这对我来说不好。

ok, i cant find the method called by UIViewController that presents a new view.

i have an app based on UINavigationController. Once i come to a view showing details of the object, i have 1 toolBar at the bottom so i can give some options to user.
When he press on barButtomItem, i want to show a new view but not changing the navigationbar, so if i press back button he goes back from detail view and not from new option.

i know method pushViewController but does not work as i want.

thx in advance!

edit: just to be a more bit more clear if i call
[[self navigationController]pushViewController:loteCompraViewController animated:YES];
i get a new view, related to the new controller but it also changes the navigationbar and that is not good for me.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

度的依靠╰つ 2024-12-24 00:28:04

为“显示对象详细信息的视图”的视图控制器提供两个方法:isShowingOverlayViewdismissOverlayView。在 isShowingOverlayView 中,如果您因为“他按下了 barButtomItem”而显示“新视图”,则返回 YES。在 dismissOverlayView 中,隐藏“新视图”。

然后创建您自己的 UINavigationController 子类。在您的子类中,重写 popViewControllerAnimated: 以使用对象详细信息视图控制器的这些方法,如下所示:

- (UIViewController *)popViewControllerAnimated:(BOOL)animated
{
    if ([self.topViewController respondsToSelector:@selector(isShowingOverlayView)]
        && [(id)self.topViewController isShowingOverlayView])
    {
        [(id)self.topViewController dismissOverlayView];
        return nil;
    } else {
        return [super popViewControllerAnimated:YES];
    }
}

使用此子类而不是标准 UINavigationController。

Give your view controller of the "view showing details of the object" two methods: isShowingOverlayView and dismissOverlayView. In isShowingOverlayView, return YES if you're showing the "new view" because "he press on barButtomItem". In dismissOverlayView, hide the "new view".

Then make your own subclass of UINavigationController. In your subclass, override popViewControllerAnimated: to use those methods of your object-detail view controller, like this:

- (UIViewController *)popViewControllerAnimated:(BOOL)animated
{
    if ([self.topViewController respondsToSelector:@selector(isShowingOverlayView)]
        && [(id)self.topViewController isShowingOverlayView])
    {
        [(id)self.topViewController dismissOverlayView];
        return nil;
    } else {
        return [super popViewControllerAnimated:YES];
    }
}

Use this subclass instead of the standard UINavigationController.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文