【问题标题】:TabBar combined with Navigation Bar / Search Bar and TableViewTabBar 结合 Navigation Bar/Search Bar 和 TableView
【发布时间】:2009-12-23 12:31:23
【问题描述】:

我在我的 iPhone 应用程序中使用了一个 TabBar,并以编程方式集成了它。 我有几个 TabBarItems,每次点击都会加载一个带有相应 XYZ-View.xib 的 XYZ-ViewController。

现在我有一个带有 TabBar 的屏幕和一个带有 SearchBar 的 NavBar 和一个分段控件,就像 Apple 的这个示例一样: http://developer.apple.com/iphone/library/samplecode/TableSearch/index.html

但是在这个例子中,没有 TabBar 并且将源代码复制到我的项目中会导致问题,我在 XViewController.m viewDidLoad 方法中进行了加载:

// Add create and configure the navigation controller.
MyAppDelegate *myAppDelegate = [[UIApplication sharedApplication] delegate];

// Add create and configure the navigation controller.
UINavigationController * navigationController = [[UINavigationControlleralloc] initWithRootViewController:self];
myAppDelegate.navController = navigationController;
[navigationController release];
[myAppDelegate.window addSubview:myAppDelegate.navController.view];

效果是,有一个标题正确的工具栏,但底部没有搜索栏,也没有TabBar。

谁能告诉我这里出了什么问题?

【问题讨论】:

  • 搜索栏在那里。我必须重新连接奥特莱斯,然后搜索一切正常。但主要问题仍然存在:TabBar 消失在 TableView 后面。 TableView 似乎覆盖了它。单击一个tableviewcell,它会翻转到带有右侧工具栏和一个“后退按钮”的下一个屏幕,在这里我看到了TabBar,但它是不可点击的。那么,这里有什么问题?我必须做什么?提前非常感谢!

标签: iphone uinavigationcontroller uitabbarcontroller uisearchbar


【解决方案1】:

我解决了这个问题:

UINavigationController *navigationController = [[UINavigationController alloc] initWithRootViewController:test2ViewController];

NSArray* controllers = [NSArray arrayWithObjects:test1ViewController, navigationController, test3ViewController, nil];
[self.myTabBarController setViewControllers:controllers];

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2017-11-28
    • 1970-01-01
    • 2019-11-25
    • 1970-01-01
    • 2014-02-13
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多