clayallsopp / formotion

Making iOS Forms insanely great with RubyMotion
http://clayallsopp.github.com/formotion/
Other
608 stars 103 forks source link

How to separate formation into it's own controller? #11

Closed jjuliano closed 12 years ago

jjuliano commented 12 years ago

Hi,

I'm trying to move all the formation stuff inside it's own separate controller, but I couldn't see any examples, I'm using a UITabBarController in my app_delegate, and the controller that it includes has an 'init' super method with additional code to set the tabBarItem.image and the init method will be called via MyController.alloc.init

could you provide an example on how to separate the formation stuff into it's own controller?

mordaroso commented 12 years ago

I might not fully understand your problem.

What you can do is inherit from Formotion::FormController in your controller like this:

class MyController < Formotion::FormController
  def init
    form = Formotion::Form.new({
      sections: [{
        title: "It works",
        rows: [{
          title: "Indeed",
          type: :static
        }]
      }]
    })
    initWithForm(form)
  end
end

and then use your custom controller:

@view_controller = MyController.alloc.init
clayallsopp commented 12 years ago

@jjuliano ever get this working how you wanted?

jjuliano commented 12 years ago

Thanks this is working for me.