我正在尝试使用 Ruby Motion 构建一个基本的 Nav + Tab iPhone 应用程序。喜欢这个产品(顺便说一句!)。
问题是在构建之后您看不到标签栏标题。感谢任何帮助。
首先,我在控制器 MatchesListController.rb 中设置标题
def init
#title of first tab
if super
self.tabBarItem = UITabBarItem.alloc.initWithTitle('Matches', image:nil, tag:3)
end
self
end
然后我将所有的 NavController 加载到 TabController 中。
@postViewController = PostsListController.alloc.init
@postNavController = UINavigationController.alloc.initWithRootViewController(@postViewController)
@messagesViewController = MessagesListController.alloc.init
@messagesNavController = UINavigationController.alloc.initWithRootViewController(@messagesViewController)
@matchesViewController = MatchesListController.alloc.init
@matchesNavController = UINavigationController.alloc.initWithRootViewController(@matchesViewController)
@activitiesViewController = ActivitiesListController.alloc.init
@activitiesNavController = UINavigationController.alloc.initWithRootViewController(@activitiesViewController)
@window = UIWindow.alloc.initWithFrame(UIScreen.mainScreen.bounds)
@tabbar = UITabBarController.alloc.init
@tabbar.viewControllers = [
@postNavController,
@messagesNavController,
@matchesNavController,
@activitiesNavController
]
@tabbar.selectedIndex = 0
##### NAV CONTROLLER ######
@window.rootViewController = @tabbar
#@window.rootViewController.wantsFullScreenLayout = true
@window.makeKeyAndVisible