[TIMOB-10314] iOS: Ti.App.Properties 'change' event
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | Medium |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2012-08-13T23:38:10.000+0000 |
Affected Version/s | Release 3.0.0 |
Fix Version/s | Sprint 2012-16 API, Release 3.0.0 |
Components | iOS |
Labels | api, module_app_properties, qe-review, qe-testadded |
Reporter | Martin Guillon |
Assignee | Blain Hamon |
Created | 2012-07-26T01:43:56.000+0000 |
Updated | 2012-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
File | Date | Size |
---|---|---|
test.zip | 2012-07-26T01:43:56.000+0000 | 9093 |
pull request https://github.com/appcelerator/titanium_mobile/pull/2635
pull merged.
Verified fixed with: Titanium Studio, build: 2.1.1.201207271312 Titanium SDK, build: 2.2.0.v20120810080115 Device: iPhone 4s (5.1.1)
Re-opening to edit label
Occurs on: SDK: 2.1.2.v20120821160113 STUDIO: 2.1.2.201208201549 Device: samsung galaxy tab(v3.2) Fixed with: Release 2.2.0