【问题标题】:Xcode tabbed application show second UITableViewXcode 选项卡式应用程序显示第二个 UITableView
【发布时间】:2014-04-02 18:43:16
【问题描述】:

我们对XCode 选项卡式应用程序有疑问。 我们创建了一个带有选项卡式应用程序的 App,其中包含 3 个选项卡栏项。

  1. 一个标签栏项目只是一个按钮和一个带有 imageview(按钮在标签栏中)。

  2. 第二个标签栏项通过导航控制器连接到 UITableViewcontroller 连接到秒 UITableViewcontroller。在第一个 UITableViewcontroller 我们有一个 产品列表和第二个UITableViewcontroller 是一个列表 在第一个 UITableViewcontroller 中选择产品的详细信息。

  3. 当用户在我们想去的标签栏上点击按钮(步骤 1) 到第 2 步中的第二个 UITableView。

所以我们想跳过第一个UITableViewcontroller。 这可以通过编程方式完成吗?

【问题讨论】:

    标签: ios iphone objective-c xcode uitableview


    【解决方案1】:

    是的,有可能。

    1. 如果你使用UITabBarController,你可以使用selectedIndex属性来设置显示的UIViewController。在此处阅读有关管理UITabBarController 的更多信息:

      https://developer.apple.com/library/ios/documentation/uikit/reference/UITabBarController_Class/Reference/Reference.html

    2. 如果您只使用UITabBar 视图,它有一个名为selectedItem 的属性,并且您提供了第二个标签栏项目。因此,连接您的按钮以正确更新UITabBar 属性并将第二个UITableViewController 推送到导航堆栈上。在此处阅读有关UITabBar 的更多信息:

      https://developer.apple.com/library/ios/documentation/uikit/reference/UITabBar_Class/Reference/Reference.html

    3. 开始使用UITabBarController,它是专门为像您这样的情况而创建的。

    详细了解 iOS 中的导航:

    https://developer.apple.com/library/ios/documentation/WindowsViews/Conceptual/ViewControllerCatalog/Chapters/NavigationControllers.html

    【讨论】:

    • 我们有一个自定义的 tabbarcontroller 类,中间的 tabbaritem (selectedindex 1) 是一个 UIButton。单击此按钮时,我想直接转到 selectedindex (0)tabbaritem,其中包含:navigationcontroller > tableviewcontroller > tableviewcontroller,我想直接转到最后一个 tableviewcontroller。
    猜你喜欢
    • 2011-12-18
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-01-01
    相关资源
    最近更新 更多