removing a view crashes the app (1.0.0 mobile) ?

You must Login before you can answer or comment on any questions.

Have I got the syntax wrong?

https://developer.appcelerator.com/apidoc/mobile/1.0/Titanium.UI.Window.remove

But (and this is sudo code)

var view = Ti.UI.createView();
 
   var button = Ti.UI.createButton({
        title: 'Do Search',
    });
    button.addEventListener('click', function(e)
    {
       win.remove(view);
    });
 
    win.add(view);
Clicking the button crashes the simulator...

2010-03-10 10:05:32.461 XXXX[3508:207] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[TiUIWindowProxy removeFromSuperview]: unrecognized selector sent to instance 0x5a089d0'

There is no example of this in the kitchensink that I can find.

Any help much appreciated

3 Answers

I've run into the same issue with a variety of different views that have been added - win.remove doesn't seem to work. It is compounded by not having any way to see what views currently have been added, nor any other way to clear out all the widgets that are currently added to a view.

Haven't been able to find a ticket for this one yet.

Rob, I'm guessing that's a typo as win.close(); obviously works on windows, but on a view - unless I'm reading that wrong

In the snippet you posted you never did a win.add(view), but you are trying to remove it. Have you tried adding it first before removing it? I had some issues with .remove so I switched to using view.close() for now.

Your Answer

Think you can help? Login to answer this question!