Help us understand the problem. What is going on with this article?

RubyMotionでiOS Simulatorを任意の拡大/縮小率にセットする

More than 5 years have passed since last update.

RubyMotion Kaigiに行くので、簡単にコマンドとして作ってみました。

↓自分のエントリーですが、参考までに。
iOS Simulatorを任意の拡大/縮小率で表示する

インストール

~/Library/RubyMotion/command/scale.rbとしてのコードを保存します。

~/Library/RubyMotion/command/scale.rb
module Motion; class Command
  class Scale < Command
    self.summary = 'Set Simulator Scale'
    self.description = 'Set iOS Simulator Window Scale. Set value (0.3 = 0.3x).'
    self.arguments = '[zoom_scale]'

    def initialize(argv)
      @zoom_scale = argv.shift_argument
      super
    end

    def validate!
      super
      help! "Specify a window scale of iOS Simulatorter." unless @zoom_scale
    end

    def run
      line = "defaults write com.apple.iphonesimulator SimulatorWindowLastScale "
      line << "#{@zoom_scale}"
      system(line)
    end
  end
end; end

使い方

プロジェクトディレクトリーで

motion scale 0.4
rake device_name="iPhone 6 Plus"

とすれば0.4倍にシミュレータのズームサイズを設定してiPhone6 Plusで実行できます。

ごにょごにょ

RubyMotionのコマンドとして追加するよりはrakeコマンドとして「rake device_name="iPhone 6 Plus" scale=0.4」のように
作った方が適切かもしれませんが、ちょっと調べきれなかったので。

Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away