module MotionHybrid::Styleable

Public Instance Methods

on_init() click to toggle source
Calls superclass method
# File lib/motion-hybrid/concerns/styleable.rb, line 4
def on_init
  super
  self.title = nil
  set_style_class if using_freestyle_css?
  set_webview_options
  set_tab_bar_options
  remove_back_button_label
end
tab_bar=(tab_bar) click to toggle source
# File lib/motion-hybrid/concerns/styleable.rb, line 13
def tab_bar=(tab_bar)
  @tab_bar = tab_bar
end

Private Instance Methods

remove_back_button_label() click to toggle source
# File lib/motion-hybrid/concerns/styleable.rb, line 43
def remove_back_button_label
  navigationItem.backBarButtonItem = UIBarButtonItem.alloc.initWithTitle("", style: UIBarButtonItemStylePlain, target: nil, action: nil)
end
set_style_class() click to toggle source
# File lib/motion-hybrid/concerns/styleable.rb, line 23
def set_style_class
  navigationController.navigationBar.styleClass = style_class if nav_bar?
  view.styleClass = style_class
end
set_tab_bar_options() click to toggle source
# File lib/motion-hybrid/concerns/styleable.rb, line 39
def set_tab_bar_options
  set_tab_bar_item title: @tab_bar[:title], icon: Icon.new(@tab_bar[:icon], 24) if @tab_bar
end
set_webview_options() click to toggle source
# File lib/motion-hybrid/concerns/styleable.rb, line 34
def set_webview_options
  set_attributes webview, keyboard_display_requires_user_action: false, suppresses_incremental_rendering: true, background_color: UIColor.whiteColor
  set_attributes webview.scrollView, deceleration_rate: 0.999
end
style_class() click to toggle source
# File lib/motion-hybrid/concerns/styleable.rb, line 28
def style_class
  style_class = self.class.to_s.underscore
  style_class += ' modal' if modal?
  style_class
end
using_freestyle_css?() click to toggle source
# File lib/motion-hybrid/concerns/styleable.rb, line 19
def using_freestyle_css?
  view.respond_to?(:styleClass)
end