Using the same titlebar for all my tab windows (iPhone)

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

Hi,

I'm newbie with Appcelerator and so far, I'm pretty happy of what can be done with it.

Right now, I'm working on a quick test application. I have 5 tabs which all link to specific windows ... do not know if it's the right way to do it but is there any way to have a 'global' or unique titlebar that can be use for any windows?

Thanks

2 Answers

Accepted Answer

Hi Steve, if you are using 5 tabs, means you are using tab group and in that case you get inbuilt title bar in iPhone, if you set the Title Property of the window.... you just set the title property of the windows...

— answered 8 months ago by Ashish Nigam
answer permalink
3 Comments
  • Hi Ashish,

    thanks for your feedback. You are right, I'm using 5 tabs but each tab link to his own window. Is it the right way to do it?

    Right now, I have 5 windows which means 5 Title Property... does it means that I just need to add the same title for all 5 windows?

    Thanks

    — commented 8 months ago by Steve Paquette

  • Yes, Ideally you should add different window to different Tab unless any condition needs to violate that.

    and if you need the same Title bar for all the window then....YES set the same title for all the windows.

    — commented 8 months ago by Ashish Nigam

  • Thanks Ashish

    — commented 8 months ago by Steve Paquette

using the commonJS approach, I create building blocks to be used across the application.

DonationBar.js has a view that is positioned at the top of its parent, is white, has a 2 pixel high child view that is black.

DonationBar.js

var DonationBar = function(){
    var self = Ti.UI.createView({
        backgroundColor: 'white',
        width: Ti.UI.FILL,
        height: 52,
        top: 0
    });
 
    var header = Ti.UI.createView({
        height: 2,
        width: Ti.UI.FILL,
        bottom: 0,
        backgroundColor: 'black'
    });
 
    self.add(header);
    return self;
};
 
module.exports = DonationBar;
It can be added to any window as so:
var DonationBar = require('/ui/common/DonationBar');
var donationBar = new DonationBar();
self.add(donationBar); // self being your window
One change in your DonationBar.js and its applied across all its locations in the app.

Your Answer

Think you can help? Login to answer this question!