gpt4 book ai didi

ios - 带有 RubyMotion 的顶部栏 iOS 应用程序?

转载 作者:行者123 更新时间:2023-11-28 22:53:35 25 4
gpt4 key购买 nike

我是 RubyMotion 和 iOS 开发的新手,我想在我的应用程序中放置一个顶部栏,例如 this one from groupme并在其中间放置一个图标。

我该怎么做?图书馆是什么?如何将其附加到 View ?

我的app_delegate.rb中有代码,目前:

class AppDelegate
def application(application, didFinishLaunchingWithOptions:launchOptions)
@window = UIWindow.alloc.initWithFrame(UIScreen.mainScreen.bounds)

tabbar = UITabBarController.alloc.init
tabbar.viewControllers = [
ProductMapController.alloc.init,
SearchController.alloc.init,
NewProductController.alloc.init,
FeedController.alloc.init,
UserDetailsController.alloc.init
]
tabbar.selectedIndex = 0
@window.rootViewController = UINavigationController.alloc.initWithRootViewController(tabbar)
@window.rootViewController.wantsFullScreenLayout = true
@window.makeKeyAndVisible

true
end
end

谢谢,我很感激你能给我的任何帮助。

最佳答案

我找到了解决方案:

在我的 app_delegate.rb 中我有:

items_controller = ProductsController.alloc.initWithNibName(nil, bundle: nil)
@window.rootViewController = UINavigationController.alloc.initWithRootViewController(items_controller)

然后在我的 items_controller.rb 我有:

self.navigationItem.titleView = UIImageView.alloc.initWithImage(UIImage.imageNamed('logo.png'))

我认为这完全没问题,因为我不再真正污染我的 app_delegate.rb :)

如果你有更好的解决方案,请告诉我。

关于ios - 带有 RubyMotion 的顶部栏 iOS 应用程序?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11285922/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com