(IOS) ActivityIndicator show randomly in the title of navBar instead of rightButton

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

Hi, Since a few weeks I face a problem where instead of always showing the activity indicator on the rightButton it sometimes show it in the title of the window. I have seen this on iPhone and iPad since 2.0. Same problem on last SDK.

here's the code I use :

//this is how I create the activity
var navActInd = Titanium.UI.createActivityIndicator();
 
//When I need to display it
win.setRightNavButton(navActInd);   
navActInd.show();
 
//Do my stuff here
 
//When I need to hide it
navActInd.hide();   
win.setRightNavButton(myBtn);
Any idea ? Thanks

1 Answer

Accepted Answer

Hi Armindo, are you using single window application? and also provide the complete code to test.

Single window application is already having bug related to Navigation Bar and even i have raised the JIRA Bug against it.

— answered 8 months ago by Ashish Nigam
answer permalink
9 Comments
  • Hi Ashish, it's not a single window app, it's a tabbed one. Will try to make a sample app and post it here. Thanks.

    — commented 7 months ago by Armindo Da Silva

  • I have just created a tabbed application project, and I have replaced the ApplicationWindows.js code by this :

    function ApplicationWindow(title) {
        var self = Ti.UI.createWindow({
            title:title,
            backgroundColor:'white'
        });
     
     
        var navActInd = Titanium.UI.createActivityIndicator();
     
     
     
        var button = Ti.UI.createButton({
            height:44,
            width:200,
            title:L('Show Activity indictor'),
            top:20
        });
        self.add(button);
     
        button.addEventListener('click', function() {
            self.setRightNavButton(navActInd);
            navActInd.show();
        });
     
     
        var button2 = Ti.UI.createButton({
            height:44,
            width:200,
            title:L('Hide Activity indictor'),
            top:70
        });
        self.add(button2);
     
        button2.addEventListener('click', function() {
            navActInd.hide();
            self.setRightNavButton(null);
        });
     
     
     
     
     
        return self;
    };
     
    module.exports = ApplicationWindow;
    you can try, show, hide, the the second show will show the activity in the title bar not in the rightButton.

    This occurs on many iPhone and iPad apps.

    Regards

    — commented 5 months ago by Armindo Da Silva

  • Hi Armindo, i checked you code seems a bug... As 1st time it run fine then on further click it creates problem and uncertain behavior...

    but if you are looking at alternative then here is little modification in code which resolve the problem for time being..

    function ApplicationWindow(title) {
        var self = Ti.UI.createWindow({
            title:title,
            backgroundColor:'white'
        });
     
     
        var navActInd = Titanium.UI.createActivityIndicator();
     
     var view = Ti.UI.createView({
            height:44,
            width:30,
            top:1
        });
        view.add(navActInd);
     
        var button = Ti.UI.createButton({
            height:44,
            width:200,
            title:L('Show Activity indictor'),
            top:20
        });
        self.add(button);
     
        button.addEventListener('click', function() {
            self.setRightNavButton(view);
            navActInd.show();
        });
     
     
        var button2 = Ti.UI.createButton({
            height:44,
            width:200,
            title:L('Hide Activity indictor'),
            top:70
        });
        self.add(button2);
     
        button2.addEventListener('click', function() {
            navActInd.hide();
            self.setRightNavButton(null);
        });
     
     
     
     
     
        return self;
    };
     
    module.exports = ApplicationWindow;

    — commented 5 months ago by Ashish Nigam

  • Show 6 more comments

Your Answer

Think you can help? Login to answer this question!