Sha256: 6097981b776552b8e2e1ed3f6c870af78fa36f0b2e8e15608c57d4f58a82052b

Contents?: true

Size: 1.73 KB

Versions: 3

Compression:

Stored size: 1.73 KB

Contents

module ProMotion
  if defined?(Formotion) && defined?(Formotion::FormController)
    class FormotionScreen < Formotion::FormController
      include ProMotion::ScreenModule

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

        if s.respond_to?(:table_data)
          s.form = s.table_data
        elsif args[:form]
          s.form = args[:form]
        else
          PM.logger.error "PM::FormotionScreen requires a `table_data` method or form: to be passed into `new`."
        end

        s.tableView.allowsSelectionDuringEditing = true

        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
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
ProMotion-0.7.2 lib/ProMotion/screens/_compatibility/formotion_screen.rb
ProMotion-0.7.1 lib/ProMotion/screens/_compatibility/formotion_screen.rb
ProMotion-0.7.0 lib/ProMotion/screens/_compatibility/formotion_screen.rb