Search code examples
rubyrubymotion

app cannot find app_width (Ruby motion query)


My app can't find app_width.

Error

undefined local variable or method app_width for #<MainStylesheet:0x10b563030 ...> (NameError)

main_stylesheet.rb

class MainStylesheet < ApplicationStylesheet

  ...

  def logo_text(st)
    st.image = image.resource('logo-text')
    if landscape?

    else
      st.frame = {t: 250, w: app_width, h: 60, centered: :horizontal}
    end

  end

end

Solution

  • app_width is deprecated and has been removed in version 1.2.0.

    Use device_width or screen_width instead.