I'm developing an app with a list of train stations and when you select a station from the list, there should be a view that shows more information.
For the list I'm using PM::TableScreen
In there I have this method that gets called when a user selects a station:
def select_station(station)
open StationScreen.alloc.initWithStation(station)
end
And the corresponding StationScreen
class StationScreen < UIViewController
def initWithStation(station)
init.tap do
@station = station
end
end
def loadView
self.title = @station[:name]
@layout = StationLayout.new
self.view = @layout.view
end
end
This produces the following:
Effects are smooth when you click the back button.
Now, I wanted to switch to ProMotion::Screen
StationScreen becomes:
class StationScreen < PM::Screen
attr_accessor :station
def on_load
self.title = @station[:name]
@layout = StationLayout.new
self.view = @layout.view
end
end
And the select_station method:
def select_station(station)
open StationScreen.new(station: station)
end
Now the back animation is very strange. Notice how the image is still displayed for a while, and then goes away.
What am I doing wrong and how implement it properly with ProMotion::Screen
?
UPDATE 1: This fixed it. Examples for ProMotion are suggestion the wrong thing.
def load_view
self.title = @station[:name]
@layout = StationLayout.new
self.view = @layout.view
end
Is this the right way to do it?