@@ -223,7 +223,7 @@ var Controller = function() {
223
223
* {@link Titanium.UI.View#method-applyProperties applyProperties} method
224
224
* or a create object method, such as {@link Titanium.UI#method-createView Titanium.UI.createView}.
225
225
* #### Examples
226
- * The following creates a new style object that passed as a parameter
226
+ * The following creates a new style object that is passed as a parameter
227
227
* to the {@link Titanium.UI#method-createLabel Ti.UI.createLabel()} method.
228
228
229
229
var styleArgs = {
@@ -238,7 +238,7 @@ var Controller = function() {
238
238
testLabel = Ti.UI.createLabel(styleObject);
239
239
240
240
* The next example uses the {@link Titanium#method-applyProperties applyProperties()} method
241
- to add apply a style object to an existing Button control (button not shown).
241
+ * to apply a style object to an existing Button control (button not shown).
242
242
243
243
var style = $.createStyle({
244
244
classes: args.button,
@@ -351,34 +351,39 @@ The 'redbg' and 'bigger' classes are shown below:
351
351
/**
352
352
* @method updateViews
353
353
* Applies a set of properties to view elements associated with this controller.
354
- * @param {Object } args An object whose keys are the IDs (in form '#id') of views to which the styles will be applied.
355
- * @since 1.4.0
354
+ * This method is useful for setting properties on repeated elements such as
355
+ * {@link Titanium.UI.TableViewRow TableViewRow} objects, rather than needing to have a controller
356
+ * for those child controllers.
356
357
* #### Example
357
- * The following example updates the UI elements with IDs "container"
358
- * and "name", providing new values for the `layout` and `text`
359
- * properties of those elements, respectively.
358
+ * The following example uses this method to update a Label inside a TableViewRow object
359
+ * before adding it to a TableView.
360
+
361
+ * View-controller file: controllers/index.js
362
+
363
+ for (var i=0; i < 10; i++) {
364
+ var row = Alloy.createController("tablerow");
365
+ row.updateViews({
366
+ "#theLabel": {
367
+ text: "I am row #" + i
368
+ }
369
+ });
370
+ $.tableView.appendRow(row.getView());
371
+ };
360
372
361
- * View-controller file: controllers/profile.js
373
+ * XML view: views/tablerow.xml
362
374
363
- var profile = Alloy.createController('profile');
364
- profile.updateViews({
365
- "#container" : {
366
- layout : "vertical"
367
- },
368
- "#name" : {
369
- text : "Mr. Jones"
370
- }
371
- });
372
- $.index.add(profile.getView());
373
- $.index.open();
375
+ <Alloy>
376
+ <TableViewRow>
377
+ <Label id="theLabel"></Label>
378
+ </TableViewRow>
379
+ </Alloy>
374
380
375
- * XML view: views/profile .xml
381
+ * XML view: views/index .xml
376
382
377
- <Alloy>
378
- <View id="container">
379
- <Label id="name"/>
380
- </View>
381
- </Alloy>
383
+ <TableView id="tableView">
384
+ </TableView>
385
+ * @param {Object } args An object whose keys are the IDs (in form '#id') of views to which the styles will be applied.
386
+ * @since 1.4.0
382
387
383
388
*/
384
389
updateViews : function ( args ) {
0 commit comments