1

In the on_load method of HomeScreen class i want to do something like rmq.append(LoginScreen, :login_form). LoginScreen inherits from PM::FormScreen. enter image description here

Since I am not implementing initWithFrame in LoginScreen the app crashes.

This has been done in http://jamonholmgren.com/getting-started-with-motionkit-and-promotion/ but with motion kit. How can I achieve the same with rmq?

yogi_bear
  • 313
  • 4
  • 12

1 Answers1

2

You're going to need to create an instance of the screen and then add its view.

def on_load
  @login_screen = LoginScreen.new
  addChildViewController @login_screen
  rmq.append(UIImageView, :logo)
  rmq.append(@login_screen.view, :login_form)
end

The addChildViewController ensures that lifecycle events are properly called on LoginScreen.

Jamon Holmgren
  • 23,738
  • 6
  • 59
  • 75
  • I tried using the `addChildViewController ` but it did not work. I have posted my question in the comment below. I think its relevant to promotion and motionkit. Please have a look and help me out... thanks – theCrab Nov 22 '16 at 10:27
  • I am using ProMotion-map. I cannot seam to get the map touch events. I am assuming there is a view above the map which is covering the map layer. In promotion-map, the `on_load` presents a `MKMapView` as `self.view` if you do not declare one. Here is the gist for the code And this picture below is the end result. But somehow it adds a view with `UIColor.clearColor` on top of the map. https://gist.github.com/theCrab/5f57a4662641e2e54f7a4c1ab1be61e9 https://i.stack.imgur.com/UTZRb.png – theCrab Nov 22 '16 at 20:03