【问题标题】:iPad - multiple UIBarButtonItemiPad - 多个 UIBarButtonItem
【发布时间】:2010-06-25 13:26:53
【问题描述】:

我有 UINavigationController 并在其中放置了 UIListView。现在我想在导航栏的左侧添加多个 BarButtons。这怎么可能?我设法通过代码添加了一个按钮,但没有添加多个。

编辑: 通过 IB 添加到 UINavigationController 的 NavigationBar 的按钮根本不可见。什么可能导致问题?

我在 .h 文件中创建了 UINavigationController 并在 .m 中使用它并推送了另一个视图(即 TableView):

navigationController = [[UINavigationController alloc] init];
[window addSubview:[navigationController view]];

tableOfContents *tableOfContentsViewController = [[tableOfContents alloc] init];
[navigationController pushViewController:tableOfContentsViewController animated:NO];
[tableOfContentsViewController release];

编辑 2:我解决了第二个问题。所以只剩下第一个问题。多个 BarButtonItems ...

【问题讨论】:

    标签: ipad uinavigationcontroller uibarbuttonitem


    【解决方案1】:

    iOS 5.0 具有执行此操作的 API。检查UINavigationItem类的以下属性

    leftBarButtonItems 
    

    rightBarButtonItems

    leftItemsSupplementBackButton
    

    【讨论】:

      【解决方案2】:

      您可以这样做的唯一方法是将 UIBarButtonItem 添加到 UIToolBar 并使用 UIToolBar 作为 customView 制作 UIBarButtonItem。

      网上有很多例子,看看: http://osmorphis.blogspot.com/2009/05/multiple-buttons-on-navigation-bar.html

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2013-10-14
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多