【问题标题】:How to add an app icon to a RubyMotion OS X app?如何将应用程序图标添加到 RubyMotion OS X 应用程序?
【发布时间】:2014-07-28 17:27:24
【问题描述】:

我正在使用 RubyMotion 创建一个 OS X 应用程序。我想添加一个应用程序图标。我将我的stopwatch.png 文件复制到资源目录并在Rakefile 中指定了文件名:

# -*- coding: utf-8 -*-
$:.unshift("/Library/RubyMotion/lib")
require 'motion/project/template/osx'

begin
  require 'bundler'
  Bundler.require
rescue LoadError
end

Motion::Project::App.setup do |app|
  app.name = 'Timetracker'
  app.icon = 'stopwatch.png'
end

当我运行rake 时,它不会应用我的图标。我什至跑了rake build 并且创建的.app 不使用我的图标。我做错了什么?

【问题讨论】:

    标签: macos rubymotion


    【解决方案1】:

    您不能指定直接图像,它需要采用.icns 文件的格式。

    来源:https://groups.google.com/forum/#!topic/rubymotion/TxkA9IjRRM4

    在此处转换:http://iconverticons.com/online/

    您可能需要运行 rake clean 才能使您的图标更改生效。

    【讨论】:

    • 谢谢。似乎iConvert Icons 生成了一个有效的.icns 文件,但由于某种原因,当我运行rakerake build 时,RubyMotion 仍然没有应用该图标。
    • 终于让它工作了。必须运行 rake clean 才能使更改生效。
    • 如果更新为仅支持 .icns 而不是单个图像,那就太好了...rubymotion.com/developer-center/guides/project-management
    猜你喜欢
    • 1970-01-01
    • 2017-11-29
    • 2016-06-23
    • 1970-01-01
    • 1970-01-01
    • 2016-03-23
    • 2010-10-13
    • 1970-01-01
    • 2012-06-15
    相关资源
    最近更新 更多