Mvc - Titanium

download Mvc - Titanium

If you can't read please download the document

Transcript of Mvc - Titanium

  • 1. MVCApplication is divided into three core components: themodel, the view, and the controllerView: the interface the user sees and interacts withModel: manipulate the data in the applicationController: handles the input event from the user interface

2. Why MVC for Titanium?Better organizationCode reuseDont like messy files 3. How MVC in Titanium?Framework Used:Appcelerator on RailsRuby-based generatorModel generator creates standard code for accessing dataController generator writes both View and Controller codeMigration generator who generate SQL code for table creation 4. View and ControllerGenerate.rb ruby script generates files with template for view and controller. 5. To generate view and controllerExecute ruby script to generate view and controller>>ruby scripts/generate.rb controller ProductsAbove command generate following files:-Resources/controllers/products.js-Resources/views/products.js 6. Template generated by ruby script for viewvar ProductView =View.extend({init: function(win, controller) { this._super(win, controller); this.layout();},layout: function() { Write code to Create button/ view/ text/ field ( all UIs) }}); 7. Template generated by ruby script for controllervar ProductController = Controller.extend({init: function(win) {this._super(win);this.view = new ProductView(win, this);},btnClicked: function(event) { Write code for Action to perform}}); 8. Instantiate controllerIn app.js file://instantiate controllervar productController = newProductController(pass window);// this pass window will return value which//we could openOpen passed window; 9. What skills do we need?JavascriptTitaniumRuby (if we know ,that ll be plus point) 10. Resourceshttp://primegap.net/Google it. 11. Thank you