带RubyMotion的顶级iOS应用程序? 我对RouyStand和iOS的开发非常陌生,我想在我的应用程序中放置一个顶部的条形图,就像在它的中间放置一个图标。

带RubyMotion的顶级iOS应用程序? 我对RouyStand和iOS的开发非常陌生,我想在我的应用程序中放置一个顶部的条形图,就像在它的中间放置一个图标。,ios,ruby,rubymotion,Ios,Ruby,Rubymotion,我该怎么做?图书馆是什么?如何将其附着到视图 我的app_delegate.rb中有代码,当前: class AppDelegate def application(application, didFinishLaunchingWithOptions:launchOptions) @window = UIWindow.alloc.initWithFrame(UIScreen.mainScreen.bounds) tabbar = UITabBarController.all

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

我的
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

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

以下是你想要什么的想法:

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

    #creates a bar with a width of 320, a height of 100, and colors it blue
    bar = UIView.alloc.initWithFrame [[0, 0], [320, 100]]  
    bar.backgroundColor = UIColor.blueColor 

    #creates an imageView with the icon, change the coordinates to center your icon
    icon= UIImageView.alloc.initWithFrame([[100,0], [100,100]]) 
    icon.image = UIImage.imageNamed('youricon.jpeg')

    #adds the bar and icon to the window
    @window.addSubview bar
    @window.addSubview icon

    true
  end
end

您不希望在应用程序代理中使用此类代码,但我将其添加到此处是为了给您一个简单的示例。

我找到了解决方案:

在我的
app_delegate.rb中,我有:

items_controller = ProductsController.alloc.initWithNibName(nil, bundle: nil)
@window.rootViewController = UINavigationController.alloc.initWithRootViewController(items_controller)
然后在我的
items\u controller.rb中,我有:

self.navigationItem.titleView = UIImageView.alloc.initWithImage(UIImage.imageNamed('logo.png'))
我认为这很好,因为我不再污染我的
app\u delegate.rb


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

没有库,您自己构建。该条的背景图像将是UIImageView。然后创建一个UIButton并将其添加为子视图。瞧,完成了。:)这听起来很简单,但我是一个新手,在上面的代码中你会怎么做,你能告诉我吗?你上面发布的代码在内容上我很熟悉,但语法上我不熟悉;我用Objective-C编程iOS,而不是ruby。但是我确信有关于如何用ruby在屏幕上放置图像和按钮的文档,是吗?