简体   繁体   English

如何将应用程序图标添加到RubyMotion OS X应用程序?

[英]How to add an app icon to a RubyMotion OS X app?

I am creating an OS X app with RubyMotion. 我正在使用RubyMotion创建OS X应用程序。 I want to add an app icon. 我想添加一个应用程序图标。 I copied my stopwatch.png file to the resources directory and specified the filename in the Rakefile : 我复制我的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

When I run rake it does not apply my icon. 当我运行rake它不会应用我的图标。 I even ran rake build and the .app created does not use my icon. 我什至运行过rake build ,创建的.app不使用我的图标。 What am I doing wrong? 我究竟做错了什么?

You can't specify a direct image it needs to be in the format of a .icns file. 您无法指定直接图像,该图像必须采用.icns文件的格式。

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

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

You may need to run rake clean for your icon change to take effect. 您可能需要运行rake clean以使图标更改生效。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM