Module: MotionPrime::ScreenBaseMixin

Extended by:
MotionSupport::Concern
Includes:
ScreenAliasesMixin, ScreenNavigationMixin, ScreenOrientationsMixin, ScreenSectionsMixin, MotionSupport::Callbacks
Defined in:
motion-prime/screens/_base_mixin.rb

Defined Under Namespace

Modules: ClassMethods

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from ScreenSectionsMixin

#add_sections, #create_section, #create_sections, included, #render_sections

Methods included from HasNormalizer

#normalize_object, #normalize_options

Methods included from HasClassFactory

#camelize_factory, #class_factory, #low_camelize_factory

Methods included from ScreenNavigationMixin

#back, #close_screen, #has_navigation?, #navigation_controller, #navigation_controller=, #open_screen, #send_on_leave, #send_on_return, #wrap_in_navigation, #wrap_in_navigation?

Methods included from ScreenOrientationsMixin

#should_rotate, #supported_orientation?, #supported_orientations

Methods included from ScreenAliasesMixin

#on_appear, #on_disappear, #on_rotate, #should_autorotate, #view_did_appear, #view_did_disappear, #view_did_load, #view_will_appear, #view_will_disappear, #will_appear, #will_disappear, #will_rotate

Instance Attribute Details

#main_sectionObject

Returns the value of attribute main_section.



15
16
17
# File 'motion-prime/screens/_base_mixin.rb', line 15

def main_section
  @main_section
end

Returns the value of attribute modal.



15
16
17
# File 'motion-prime/screens/_base_mixin.rb', line 15

def modal
  @modal
end

#optionsObject

Returns the value of attribute options.



15
16
17
# File 'motion-prime/screens/_base_mixin.rb', line 15

def options
  @options
end

#paramsObject

Returns the value of attribute params.



15
16
17
# File 'motion-prime/screens/_base_mixin.rb', line 15

def params
  @params
end

#parent_screenObject

Returns the value of attribute parent_screen.



15
16
17
# File 'motion-prime/screens/_base_mixin.rb', line 15

def parent_screen
  @parent_screen
end

#tab_barObject

Returns the value of attribute tab_bar.



15
16
17
# File 'motion-prime/screens/_base_mixin.rb', line 15

def tab_bar
  @tab_bar
end

Instance Method Details

#app_delegateObject



18
19
20
# File 'motion-prime/screens/_base_mixin.rb', line 18

def app_delegate
  UIApplication.sharedApplication.delegate
end

#main_controllerObject



56
57
58
# File 'motion-prime/screens/_base_mixin.rb', line 56

def main_controller
  has_navigation? ? navigation_controller : self
end

#modal?Boolean

Returns:

  • (Boolean)


42
43
44
# File 'motion-prime/screens/_base_mixin.rb', line 42

def modal?
  !!self.modal
end

#on_create(options = {}) ⇒ MotionPrime::Screen

Setup the screen, this method will be called when you run MPViewController.new

Parameters:

  • options (hash) (defaults to: {})

    Options passed to setup

Returns:

  • (MotionPrime::Screen)

    Ready to use screen



29
30
31
32
33
34
35
36
37
38
39
40
# File 'motion-prime/screens/_base_mixin.rb', line 29

def on_create(options = {})
  unless self.is_a?(UIViewController)
    raise StandardError.new("ERROR: Screens must extend UIViewController.")
  end

  self.options = options
  self.params = options[:params] || {}
  options.each do |k, v|
    self.send("#{k}=", v) if self.respond_to?("#{k}=")
  end
  self
end

#refreshObject



60
61
62
# File 'motion-prime/screens/_base_mixin.rb', line 60

def refresh
  main_section.try(:reload_data)
end

#titleObject



46
47
48
49
50
# File 'motion-prime/screens/_base_mixin.rb', line 46

def title
  title = self.class.title
  title = self.instance_eval(&title) if title.is_a?(Proc)
  title
end

#title=(new_title) ⇒ Object



52
53
54
# File 'motion-prime/screens/_base_mixin.rb', line 52

def title=(new_title)
  self.class.title(new_title)
end