I'm very new to RubyMotion and iOS development and I wanna put a top bar in my app, like this one from groupme and place an icon in the middle of it.
How do I do that? What is the library? How do I attach it to the view?
There is the code in my app_delegate.rb
, currently:
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
Thank you, I appreciate any help you can give me.
I found the solution for this:
In my app_delegate.rb
I have:
items_controller = ProductsController.alloc.initWithNibName(nil, bundle: nil)
@window.rootViewController = UINavigationController.alloc.initWithRootViewController(items_controller)
then in my items_controller.rb
I have:
self.navigationItem.titleView = UIImageView.alloc.initWithImage(UIImage.imageNamed('logo.png'))
I think this is totally fine because i'm not really polluting my app_delegate.rb
anymore :)
If you have a better solution, please tell me.