As there are a lot of questions in this forum about basic MVC stuff, I built a little sample app (using the WebStorm IDE) that should help to understand of few of the concepts:
This is a full runable project made with ST2.3.0. and CMD4. Just expand it into your local web directory and launch it with 'localhost/testmvc'. It should be quite self explaining when you look at the code. Almost every view has a controller with the same name that does the logic.
The app handles the following:
- the main part of the app is a TabBar with 3 tabs
- the Guests tab is a NavigationView with a list of guests
- the list can be filtered
- a tap on a item shows the detail (form)
- it shows how you can handle buttons in a view or form
- it shows how you can handle buttons on a navigation bar
- the Settings tab is just a list with the countries
- its controller shows how to load it with a programmatically built array of data
- the country list is used for the selectfield in the guest detail form
Open the devtools (F12) console to see some logging when you interact with it.
Disclaimer: this is just one way of doings things. There may be other and even better ways (and there might be some bugs as well). But this is as most of my apps currently work.
Comments and additional requirements/wishes welcome!
04-11-2013 09-57-19.png04-11-2013 09-57-10.png04-11-2013 09-57-36.png