I am looking at adding a switch to a page in an app and adding a fire event to it. When the switch is "ON" I would like it to increase the text size on each page of the app by 2-4 point. Any help on this would be great.
2 Answers
There is not a global text size property for pages. So you'll have to keep an array of text elements stored, then when the change event is fired on the switch, you'll have to loop over your text elements and change the font size for each one.
You could save the switch setting as an application property, i.e. using code like
Ti.App.Properties.setString('textSize', someVariable);Where
someVariable holds information you can use to determine the switch setting, and 'textSize' is just a string to help retrieve the value later.
Then, in each affected window you can add an "on focus" event to the window so that when the window is displayed it changes the text size:
var win = Ti.UI.currentWindow(); win.addEventListener('focus', function(e){ // Get the switch state and store it in a variable. var switchState = Ti.App.Properties.getString('textSize'); // Then the code to change the text size follows here, with // logic based on the value of switchState });
Your Answer
Think you can help? Login to answer this question!