Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-10314] iOS: Ti.App.Properties 'change' event

GitHub Issuen/a
TypeBug
PriorityMedium
StatusClosed
ResolutionFixed
Resolution Date2012-08-13T23:38:10.000+0000
Affected Version/sRelease 3.0.0
Fix Version/sSprint 2012-16 API, Release 3.0.0
ComponentsiOS
Labelsapi, module_app_properties, qe-review, qe-testadded
ReporterMartin Guillon
AssigneeBlain Hamon
Created2012-07-26T01:43:56.000+0000
Updated2012-08-24T02:30:40.000+0000

Description

added a "change" event to Ti.App.Properties to listen for changes of Properties The test case comes with a settings.bundle in attachment which allows to really test that feature.
var win = Ti.UI.createWindow({
    backgroundColor: 'white'
});

var info = Ti.UI.createLabel();
win.add(info);

var switchButton = Ti.UI.createSwitch({
    top:40,
     value:Ti.App.Properties.getBool('test') // mandatory property for iOS 
});
switchButton.addEventListener('change',function(_event){
    Ti.App.Properties.setBool('test', _event.value);
});
win.add(switchButton);

function onPropertiesChange()
{
    switchButton.value = Ti.App.Properties.getBool('test');
    info.text = 'onPropertiesChange';
    Ti.API.info('onPropertiesChange')
    setTimeout(function(){info.text = '';}, 1000);
}
    
Ti.App.Properties.addEventListener('change',onPropertiesChange);

win.addEventListener('close', function() {
    Ti.App.Properties.removeEventListener('change',onPropertiesChange);
});

win.open();

Attachments

FileDateSize
test.zip2012-07-26T01:43:56.000+00009093

Comments

  1. Martin Guillon 2012-07-26

    pull request https://github.com/appcelerator/titanium_mobile/pull/2635
  2. Blain Hamon 2012-07-31

    pull merged.
  3. Evgenii Tcarev 2012-08-10

    Verified fixed with: Titanium Studio, build: 2.1.1.201207271312 Titanium SDK, build: 2.2.0.v20120810080115 Device: iPhone 4s (5.1.1)
  4. Shyam Bhadauria 2012-08-13

    Re-opening to edit label
  5. Anshu Mittal 2012-08-24

    Occurs on: SDK: 2.1.2.v20120821160113 STUDIO: 2.1.2.201208201549 Device: samsung galaxy tab(v3.2) Fixed with: Release 2.2.0

JSON Source