Sha256: 66842d6ddcec2c9d40a982d189dce467f594fbcb8ca25a21ec51f5665f437ed0

Contents?: true

Size: 1.58 KB

Versions: 3

Compression:

Stored size: 1.58 KB

Contents

module ProMotion
  
class FormotionScreen < Formotion::FormController # Can also be < UIViewController
  include ProMotion::ScreenModule # Not TableScreenModule since we're using Formotion for that

  # Required functions for ProMotion to work properly

  def form_data
    {}
  end
  
  def init_form
    @local_form=Formotion::Form.new(form_data)
    if self.respond_to?(:on_submit)
      @local_form.on_submit do |form|
        self.on_submit(form.render)
      end
    end
    self.initWithForm(@local_form)
  end

  def self.new(args = {})
    s = self.alloc.init_form
    s.on_create(args) if s.respond_to?(:on_create)
    s
  end

  def viewDidLoad
    super
    self.view_did_load if self.respond_to?(:view_did_load)
  end

  def viewWillAppear(animated)
    super
    self.view_will_appear(animated) if self.respond_to?("view_will_appear:")
  end

  def viewDidAppear(animated)
    super
    self.view_did_appear(animated) if self.respond_to?("view_did_appear:")
  end

  def viewWillDisappear(animated)
    self.view_will_disappear(animated) if self.respond_to?("view_will_disappear:")
    super
  end

  def viewDidDisappear(animated)
    self.view_did_disappear(animated) if self.respond_to?("view_did_disappear:")
    super      
  end

  def shouldAutorotateToInterfaceOrientation(orientation)
    self.should_rotate(orientation)
  end

  def shouldAutorotate
    self.should_autorotate
  end

  def willRotateToInterfaceOrientation(orientation, duration:duration)
    self.will_rotate(orientation, duration)
  end

  def didRotateFromInterfaceOrientation(orientation)
    self.on_rotate
  end
end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
ProMotion-formotion-0.0.5 lib/ProMotion/formotion_screen.rb
ProMotion-formotion-0.0.4 lib/ProMotion/formotion_screen.rb
ProMotion-formotion-0.0.3 lib/ProMotion/formotion_screen.rb