Uploaded image for project: 'Titanium SDK/CLI'
  1. Titanium SDK/CLI
  2. TIMOB-15692

TiAPI: removeAllChildren method for view

    Details

      Description

      It can be very useful to have a safe method to remove all children from a view.
      test case

      var win = Ti.UI.createWindow({ backgroundColor: '#fff' });
      var scrollView = Ti.UI.createScrollView({height:200,top:0});
      win.add(scrollView);
       
      var view1 = Ti.UI.createView({
      	backgroundColor:'pink',
      	zIndex:10,
      	width:200,
      	height:30,
      	top:10,
      	left:10
      });
       
      var view2 = Ti.UI.createView({
      	backgroundColor:'blue',
      	zIndex:11,
      	width:200,
      	height:30,
      	top:15,
      	left:15
      });
       
      var view3 = Ti.UI.createView({
      	backgroundColor:'red',
      	zIndex:12,
      	width:200,
      	height:30,
      	top:20,
      	left:20
      });
       
      scrollView.add(view3);
      scrollView.add(view2);
      scrollView.add(view1);
       
      var l = Ti.UI.createLabel({
      	text:'scroll view: red on top, blue in the middle, pink below',
      	color:'#777',
      	width:300,
      	height:20,
      	top:50,
      	left:10,
      	font:{fontSize:12}
      });
      scrollView.add(l);
       
      var buttonAdd = Ti.UI.createButton({
      	title: 'Add',
      	top: 10,
      	width: 200,
      	height: 30
      });
       
      buttonAdd.addEventListener('click', function(){
      	scrollView.add(view3);
      	scrollView.add(view2);
      	scrollView.add(view1);
      	scrollView.add(l);
      });
      win.add(buttonAdd);
       
      var buttonRemove = Ti.UI.createButton({
      	title: 'RemoveAll',
      	bottom: 10,
      	width: 200,
      	height: 30
      });
       
      buttonRemove.addEventListener('click', function(){
      	scrollView.removeAllChildren();
      });
      win.add(buttonRemove);
      win.open();
      

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                srahim Sabil Rahim
                Reporter:
                farfromrefuge Martin Guillon (Inactive)
              • Watchers:
                5 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Backbone Issue Sync

                  • Backbone Issue Sync is enabled for your project, but we do not have any synchronization info for this issue.

                    Git Integration